Launch an oversize terminal window from a script - resize

I'm using gnome in RHEL 6.4 and I've created a desktop launcher to open a terminal window to present data from a flatfile to a user (actually the launcher opens a terminal window and executes a script file, which will present the data to the users). The data is about 650 characters wide.
I've tried two concepts that I could think of, but in both cases have been limited by (presumably) the window manager itself:
xterm -geometry 650x25 -e /path/to/my/script.sh &
and resize -s 25 650 from within the /path/to/my/script.sh
Both will make the xterm the size of the actual desktop (with my current resolution, approximately only about 300 characters wide).
This causes a problem when presenting the data in the script.sh due to word wrapping.
My current workaround is to prompt the user to resize the window manually before presenting the data to them...
Is there a way to open up the terminal window to the specified size, regardless of the current size of the gnome window? Or better yet, is there a way to use the resize the window after launch (ala resize -s ); this would be preferred as there are two types of files to present to the user. One is only 450 characters wide, and the other is 650. I would love to be able to start up at 450, and if the longer file is selected, change the window to 650.
(Of Note, I recall the Solaris Java Desktop had this behavior by default; but this behavior is typically undesirable other than in the instance described above; therefore I do not want to change the default behavior of the window manager for all windows; just on the terminal window launched with the desktop launcher!)
Appreciate any ideas!
Thanks,
KSL.

Related

Cmder not wrapping correctly while emulating bash on Windows

Not too long ago, I posted this issue to the Cmder GitHub page. After two weeks, it has still gone unanswered, so I was hoping to try my luck here.
Basically, I am seeing odd behavior when resizing a window in Cmder, while running bash.
Here is the issue I posted:
To reproduce, open Cmder, and maximize the window:
While emulating a bash console (Bash on Ubuntu on Windows), shrink window size so that the command line (i.e. PS1 environment
variable), wraps to the next line.
Run the command (can be a simple Enter keystroke, as long as 1. is respected).
Maximize window size, and type a command which is longer than the previous shrunken window. Line should wrap over itself.
Can anyone reproduce this behavior? (Running Microsoft Windows
[Version 10.0.15063])
I did not observe the same behavior while emulating cmd.exe.
What's more is that I don't observe this behavior while running the application "Bash on Ubuntu on Windows".
I also tried to see if the same behavior is observed on ConEmu. When I resize the screen, I get the message: "Maximum console size ... was reached Decrease font size in the real console properties", and I'm guessing this might have to do with my high DPI screen. On top of that, I get the same behavior as in Cmder.
Any help on this is greatly appreciated :D

GNU screen: output that causes the screen to scroll leaves garbage at the bottom of the window

I'm configuring GNU screen in a cygwin environment. Re-configuring actually--it always just worked before, and when I upgraded to cygwin-64 the same config files give me unexpected behavior.
What happens is that whenever I do something in the terminal that overflows a full screen the terminal does not scroll. Instead, each new line "overwrites" the last one on the bottom row of the window. Even when the process is through, if I CTRL+l, there's a bunch of garbage left on the last three lines of the terminal. Also, when I use a program that takes up the entire screen, such as vim or irssi, the "caption" line disappears.
I suspect that there's some discrepancy between my xterm settings and screen's 'term' setting, but I'm a little at sea here and, as I said, all the same configuration files worked fine (and do work fine on other machines--both cygwin and native linux). Can anyone recommend a way to get my beloved screen to behave again?
Here's my .screenrc:
shell /bin/bash
screen -t bash 0
select 0
escape ^Zz # Instead of Control-a, make the escape/command character be Control-z
autodetach on # Autodetach session on hangup instead of terminating screen completely
startup_message off # Turn off the splash screen
defscrollback 30000 # Use a 30000-line scrollback buffer
nethack on
# Misc h4x to make scrollback work
terminfo * te#:ti#
termcapinfo xterm|xterms|xs|rxvt ti=\E7\E[?47l
# Bells are annoying
bell_msg ''
vbell off
caption always '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
You're running screen under xterm (something I do all the time myself). The screen process "knows" how big the terminal is, but that information can be out of sync with reality. I find this happens a lot when I run screen -dr from a different window.
Resizing the xterm windows causes it to send a SIGWINCH signal to the process running under it, which typically causes that process to re-query the tty settings.
Click the maximize button twice. If you're already maximized, that will restore it to a normal window and then re-maximize it; if it's not already maximized, it will do the opposite. In either case, it should cause screen to recompute the window size.
I encountered the same problem today. Thank everyone for the heads-up. The final solution I found out is that to set the mintty term type to: vt220. There must be something not right about the "xterm". After that, everything is good.
I'm answering my own question here because, while #Keith Thompson's answer does resolve the symptom of the problem, it didn't keep the symptom from occurring. He did set me on the right path, which was to install the xterm package in cygwin-64. That appears to have resolved the issue.
I downgraded screen version to Screen version 4.02.01 (GNU) 28-Apr-14 and it worked.

GNU-screen disable scrollback

How to disable scrollback (^A[ESC]) mode in screen and just have it straight up print to the terminal instead (using the builtin scroll of my terminal emulator)?
I am using screen on gnome-terminal across an ssh session
Since the terminal has builtin scroll capabilities, I just want to be able to use the scrollwheel on the mouse to scroll as opposed to using ^A[ESC]
In command mode (^A:), set scrollback 0.
A few notes:
The current length of the scrollback buffer in lines is shown (among other stuff) by the info command (after the plus character).
Using the mouse wheel will not give the same experience that screen can offer
the terminal's scrollback contains exactly data that was actually displayed
data from inactive windows is not available
split windows will show as-is
I am answering an 8 year old question that came up in a web search - the answer was in man screen.

In GNU screen, is it possible to programmatically read the status message?

I am considering writing a graphical tool that will show you what gnu-screen sessions you have and what windows are available in them. You would then be able to, for example, click on the window title and it would take you there. I do not want to modify gnu-screen in any way so that my tool can work with existing installations on other machines and so on.
I can get ordinary output from programs running inside screen out of the screen session by using a log-file, or by copying the last few lines into the exchange-buffer. What I really need in order to make a nice user interface though is the contents of the status line (the line that temporarily appears at the bottom of the window). For example, to get the list of windows in a session I can send the windowlist command, but the result is never part of the output. Does anyone know if there is a way to make screen put its messages into the log, into a paste-buffer, into the current window, or anything similar where I can grab it from another program?

Detach and reattach a complete Screen session with multiple windows

I am writing a client/server-application and when I'm testing the code I want to be able to have both the server and client in a separate terminal (+ vim). For this I thought I could use GNU Screen and divide the terminal in multiple windows (and it works great!). But I have a problem when I want to detach the whole session with windows and all. When I try to reattach the session I don't get them in windows like I arranged it, but instead they attaches like "normal" screen instances.
Also, is there a way to change the size of a screen window? Like change the height proportions of two windows splitted vertically.
your first question isn't possible because the regions (the way the windows are displayed) are bound to a single screen instance and not to a screen session.
C-a :
resize
see man screen for more explanation of the resize command