Can mouse wheel scrolling work in a Screen session?

40,212

Solution 1

Mouse scrolling and elevators will work if you enable them in your .screenrc.

Screen FAQ

Q: My xterm scrollbar does not work with screen.

A: The problem is that xterm will not allow scrolling if the alternate text buffer is selected. The standard definitions of the termcap initialize capabilities ti and te switch to and from the alternate text buffer. (The scrollbar also does not work when you start e.g. 'vi'). You can tell screen not to use these initialisations by adding the line termcapinfo xterm ti@:te@ to your ~/.screenrc file.

So in my .screenrc, I have:

termcapinfo xterm* ti@:te@

In tmux, it'd be something like (.tmux.conf):

set -g terminal-overrides 'xterm*:smcup@:rmcup@'

Solution 2

Although it is an old question, the method I found best that works for me is using Ctrl + A + ESC key combination. This makes the screen output scrollable. From the documentation page:

Virtual terminals in Screen can be manipulated by pressing the Ctrl+A key combination, and subsequently pressing a key to execute one of the commands given below:

Esc lets you scroll back and forth in your terminal output

You can find the documentation here

Solution 3

That's not the final solution, if you use this

termcapinfo xterm* ti@:te@

then the mouse scroll support will be broken inside vim i.e. mouse=vi

Solution 4

What Gilles suggested is probably the best answer, if it is possible to do.

If it is not, a workaround that should work would be to use x-mouse control to send up and down arrow keys whenever the mouse is scrolled. I've never used screens with putty, but I have used this setup on putty in windows to be able to scroll through a text file with vi or nano. I had different profiles setup, one for 3 line scroll and one for 1 line scroll.

Solution 5

Mouse scroll wheel works well with for example elinks running inside screen, which in turns runs inside gnome-terminal, so it is indeed possible. In putty tray it doesn't, tho.

Share:
40,212

Related videos on Youtube

kristi
Author by

kristi

Updated on September 18, 2022

Comments

  • kristi
    kristi over 1 year

    Is there any way to use the mouse wheel to scroll through the output of a screen session?

    I can use the keypad scroll through previous output in screen after pressing ctrl+a [. Is it possible to do this with the mouse wheel?

    (I'm using putty, but I don't think it's a putty issue, I believe it's a screen issue.)

    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' almost 13 years
      You need to tell PuTTY to send the mouse wheel events into the terminal instead of keeping them for itself. (I don't know if it's possible, but check the manual, it's pretty good.)
    • Naftuli Kay
      Naftuli Kay almost 13 years
      Even on a regular terminal session in screen, I haven't been able to get scrolling working properly outside of screen's "copy mode." I think it's a limitation of the program and not so much a Windows/Putty issue, but I could be wrong.
    • tcoolspy
      tcoolspy almost 13 years
      Our of curiosity, have you guys tried the same thing in tmux?
    • Torian
      Torian over 12 years
      @Caleb: mouse wheel on tmux works like a charm (although I'm not trying it from a putty, I don't have windows:))
  • kristi
    kristi almost 13 years
    When I'm using vim, I have set mouse=a to enable mouse scrolling. This works in putty without using screen, but it doesn't work when using screen. How do you set up x-mouse control?
  • Eric
    Eric almost 13 years
    just visit the website and download the software, it's pretty self explanatory. It's a GUI app.
  • fbence
    fbence over 7 years
    Would it be possible to edit .screenrc so that when you enter vim this is turned off and turned back on when exiting?
  • andrej
    andrej almost 6 years
    well, this is acceptable since I nearly do not use mouse scroll in vim anyway
  • Hubert Perron
    Hubert Perron almost 6 years
    This is a nice answer that point to a builtin screen feature that fix the issue of this question without any configuration change.
  • Kevin McCarpenter
    Kevin McCarpenter over 5 years
    It's worth mentioning that copy mode (C-a, ESC) pauses any currently-running process in the window in which it was used: superuser.com/questions/220139/…