I use screen with a simple status line. If I what to scroll, I use Ctrl+a ESC to enter the copy mode and then I can scroll using the keyboard. This works great also with multiple buffers and splits.

My question is: How can I configure screen to use the mouse wheel to scroll?

Note 1: Using the mouse wheel I can scroll inside my terminal, but this doesn't work with multiple buffers and splits at all.

Note 2: The termcapinfo xterm* ti@:te@ solution doesn't help, since it uses the terminal scrolling. This is not compatible with status line, multiple buffers and splits.

The best solution IMHO would be:

  • In copy mode mouse wheel used for scrolling, like keyboard arrays do.
  • If screen in the normal mode and the mouse wheel event "scroll up" comes in, screen switches to the copy mode and processes the event
  • If screen in the copy mode and the mouse wheel event "scroll down" comes in, that hits the bottom, screen leaves the copy mode
  • Screen status line is always visible and get refreshed (works already, if scrolling with keyboard)

screen does not know about the wheel-mouse. It only knows about keys (including escape-sequences) sent by the terminal and its keyboard:

  • screen knows about mouse-clicks (its source-code mentions only "left mouse-click"). You can read the source-code (display.c) to see that it does no more than that (this, in particular, is the only place where screen decodes mouse-events).
  • The xterm mouse-protocol will send buttons 4 and 5 to indicate the wheel-mouse. screen knows nothing about this; applications running in the terminal may handle it specially.
  • Some terminals will send cursor-keys to imitate up/down scrolling when in the alternate-screen. screen (as expected) passes this on to the application as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.