GNU-screen disable scrollback - gnu-screen

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.

Related

Launch an oversize terminal window from a script

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.

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.

how do you know your currently attached gnu screen session

We used gnu screen a lot in the office and sometimes if I don't take note, I end up getting lost as to what screen session I already am in.
So my question is, how do you know what screen session you're in? Do you have a way to check?
CLARIFICATION: What I need to know is when I do a:
~$ screen -ls
and I see something like:
There is a screen on:
4732.work_Sept42012 (Attached)
3551.web01 (Attached)
5521.mysql01 (Attached)
1255.tomcat05 (Detached)
3326.oracle15 (Attached)
1 Socket in /tmp/uscreens/S-icasimpan.
How do I know if I am currently connected to any of the attached session?
Thanks in advance.
In addition to the sessionname screen command, screen sets the STY environment variable for processes it starts. You can check the value of this variable from a shell:
$ echo $STY
5521.mysql01
$
Update:
ctrl+a, :sessionname can be used to display the name of the current screen session.
Previous reply (with missinterpreted question):
I struggled with this too until I came across the wonderful hardstatus feature. With these two lines in my ~/.screenrc I get the following at the bottom of my screen sessions.
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n*%f %t%{= kG}%+Lw%< %{= kG}%-=%D %M %d | %C:%s %A %1`%{-}'
What I am looking at here is a screen session on my local computer with three windows (bash, mumble, kalkyl). In the active window called mumble I am connected to another computer over ssh on which I am running another screen session with three windows (top, auto, bash). I can see see all windows in both sessions and keep track of where I am.

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

multi tabbed SSH client using screen

Is there an SSH client that can present a client side GUI interface to the screen* program?
I'm thinking of an SSH program that would hook in with screen's session handling and map client side actions (clicking on a tab, ctrl-tab, scrolling, possibly even allowing several tabs to be seen at the same time) to whatever it takes to make screen at the other end do it's thing.
* The screen program that allow multiple virtual consoles under a single terminal session, for example you can run several apps under a single SSH connection and switch between them as well as other cool things.
An interesting idea, and quite possible (vim7's tabs show as clicky GUI tabs in gnome-terminal), but I don't see the benefit of doing this..
Using the follow ~/.screenrc shows "graphical" tabs:
startup_message off
vbell off
hardstatus alwayslastline
hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}]%{=y C}[%d/%m %c]%{W}'
..which look like the following (after renaming the tabs using ctrl+a,a:
x http://img216.imageshack.us/img216/9401/picture4myi.png
You can scroll around in a screen session using "copy mode", by doing ctrl+a,[ and using the cursor keys (press Esc or ctrl+c to exit it)
You can also attach to the same screen session multiple times using the screen -x flag (rather than -r), so you could use any tabbed terminal emulator, and open one tab for each screen-window.
If you really did want to start implementing this - one option would be to look into modifying gnome-terminal, to copy the behaviour with vim's tabs for screen. Or, write your own screen client - you don't need to do anything as fragile sounding as scraping the terminal - there's a FIFO file in (usually) /tmp/uscreens/S-$USER/$PID.sessionname which I think is how screen communicates, and remember screen is open-source!
Interesting idea. I use screen everyday both on my local machine and for SSH sessions. I think your biggest problem is that I suspect most screen users are commandline junkies like me who just won't see the benefit of making a gui for tabs. In fact, I have all my terminals in one gnome-terminal window under different tabs, and having screen's text-based tabs is a nice way not to confuse the two.
I suspect it could be done, but you'd be writing a specialised terminal emulator which analyses screen's output (custom .screenrc) and retrofits the gui.
A lot of work for minimal gain.
ctrl+a shift+'
.. gui front-end to screen? what are you talking about??
also, because my rep is so low, and i cant comment, id like to LOL # geoffc for his comment in the question
I've never seen one, but the following may help you. Add to your .screenrc
To show a row of "tabs" on the bottom
caption always "%{.bW}%-Lw%{.rW}%n %t%{-}%+Lw %=%{..G} %{..Y} %m/%d"
To show the current program as the screen name [assuming you're using bash and your prompt ends with "$ " by default; others shells are the exact same idea]
shelltitle "$ |sh"