24

I love screen, but it drives me nuts that I have to stop typing input, hit CTRL+A [, and then find what I need.

Is there a way to make the scroll wheel function normally, rather than scrolling commands?

Also, is it possible to enable Shift+PageUp/PageDn?

2 Answers2

17

I use these settings with urxvt in my ~/.screenrc:

termcapinfo rxvt-unicode ti@:te@
termcapinfo rxvt ti@:te@
termcapinfo rxvt 'hs:ts=\E]2;:fs=07:ds=\E]2;screen07'

Those allow for scrollbar and mouse wheel to do "the right thing™".

Note that this is dependent on terminal type, so will not work if your terminal is not of type rxvt. If it doesn't work, try replacing rxvt and rxvt-unicode with the appropriate terminal type (get this by running printf $TERM.)

miken32
  • 466
  • 2
    +1. Using "xterm" instead of "rxvt" and "rxvt-unicode", Shift-PgUp/-PgDown work for me on gnome-terminal. But the mousewheel scrolls in the shell history. – daniel kullmann Jul 17 '12 at 07:24
  • when using gnome-terminal, mousewheel scrolls normal, i.e. in scrollback. – daniel kullmann Jul 17 '12 at 07:31
  • When I use screen in gnome-terminal. Don't worry about it... – daniel kullmann Jul 17 '12 at 07:38
  • 1
    This also worked for me using xterm in place of rvxt*. Thanks! – Bryan Agee Jul 19 '12 at 18:24
  • 2
    Could you explain what each of these command do, please? – Totor May 03 '14 at 12:39
  • @Totor: I am afraid that it's been a long long time since I looked at these. I moved to using tmux and pretty much forgot all about screen. In essence, the commands are adding support for scroll to the term cap entry. You can probably find out more by reading the man page on termcap. – Sardathrion - against SE abuse May 03 '14 at 13:42
  • With KDE konsole I have to use termcapinfo xterm ti@:te@ instead of termcapinfo rxvt ti@:te@. I am not familiar with this termcap stuff (neither with tmux) but shouldn't such configurations be more or less the same for screen and tmux? – Hauke Laging May 04 '14 at 02:16
  • @danielkullmann in your .screenrc – nishanthshanmugham Apr 01 '16 at 07:37
  • As well as replacing rxvt with xterm I had to comment out the last line to prevent output becoming corrupted. – Homme Zwaagstra May 18 '16 at 09:31
  • @HaukeLaging: Just noticed that you awarded me a bounty. Thank you! – Sardathrion - against SE abuse May 18 '16 at 09:52
  • For the record, this does work with the OS X terminal; I am going to make some edits to make it clear that rxvt may not work for everyone. – miken32 Mar 23 '18 at 23:06
  • I agree with @Totor, I'd like to see an explanation of what each of these commands do, and why I may or may not want each of them, rather than copy-pasting magic that does who-knows-what. There's a good explanation of ti@:te@ over at https://stackoverflow.com/questions/359109/using-the-scrollwheel-in-gnu-screen#answer-1125947 . The other thing (beginning with hs:) is still voodoo: I don't know what it does, nor its intent, nor why it's suggested for only rxvt and not rxvt-unicode too. Since the ti@:te@ entry alone seems to fix my problem, and I understand it, that's what I'm now using. – Don Hatch Nov 23 '20 at 06:25
2

check your $TERM variable to see what terminal you are actually using. If its xterm (or xterm*) use add this to ~/.screenrc to allow mouse scrolling:

termcapinfo xterm* ti@:te@

or to be more complete:

termcapinfo xterm*|rxvt*|kterm*|Eterm* ti@:te@

absent modifying your ~/.screenrc, you can scroll with Ctrl-a ESC and then use up-down arrows. q to quit.

Note: you can also use your mouse to change focus between split windows via adding this to your ~/.screenrc

mousetrack on

Term Cap is a device independent terminal description library/database.

References/copies from:

Terminal: termcapinfo command not found

https://en.wikipedia.org/wiki/Termcap

https://superuser.com/questions/629004/gnu-screen-change-focus-in-split-windows-with-mouse

Brian
  • 171
  • This is the answer for macos... at least it is for mojave with default preferences for terminal. – Seamus Jan 05 '20 at 08:44