0

I have a mouse with a button that toggles the friction on the mouse wheel. This way I can scroll really fast, if I want to.

In tmux however, when I use the "frictionless" mode, it will continue scrolling, even if I stop the mouse wheel. I assume that happens because tmux counts up all the key events and then just scrolls that many lines ignoring whether or not the mouse itself is still scrolling. However this only happens with multiple horizontal panes and only on the pane on the very left.

Is there a way to tell tmux to stop scrolling when the mousewheel stops. Or stop scrolling when the mousewheel is turned in the other direction?

I'm currently using tmux 2.2 in xfce4-terminal 0.6.3-3 This behaviour does not occur in xterm or urxvt.

xev output:

Scrolling up:

ButtonPress event, serial 25, synthetic NO, window 0x4a00001,
    root 0x4b2, subw 0x0, time 335774900, (128,158), root:(2049,204),
    state 0x10, button 4, same_screen YES

ButtonRelease event, serial 25, synthetic NO, window 0x4a00001,
    root 0x4b2, subw 0x0, time 335774900, (128,158), root:(2049,204),
    state 0x810, button 4, same_screen YES

Scrolling down:

ButtonPress event, serial 25, synthetic NO, window 0x4a00001,
    root 0x4b2, subw 0x0, time 335776189, (128,158), root:(2049,204),
    state 0x10, button 5, same_screen YES

ButtonRelease event, serial 25, synthetic NO, window 0x4a00001,
    root 0x4b2, subw 0x0, time 335776189, (128,158), root:(2049,204),
    state 0x1010, button 5, same_screen YES

The events are the same w/ and w/o "frictionless" mode

Patrick Ziegler
  • 373
  • 1
  • 2
  • 10
  • 2
    What button events does the mouse wheel send, with and without the "frictionless" setting enabled? Check with `xev`. – JigglyNaga Jul 10 '16 at 12:56
  • JigglyNaga See updated answer – Patrick Ziegler Jul 10 '16 at 13:02
  • I mean updated question ^^ – Patrick Ziegler Jul 11 '16 at 20:55
  • Apparently `xev` doesn't recognise "smooth" / "frictionless" scrolling. See the comments of http://unix.stackexchange.com/a/139568/90751 to provide similar information via `xinput`. What terminal are you using, and does it support smooth scrolling when not running `tmux`? – JigglyNaga Jul 12 '16 at 14:46
  • JigglyNaga: I am using xfce4-terminal. If by smooth scrolling you mean that it will scroll in between lines (cutting them off), then no. It normally scrolls 9 rows each scroll event but I think that depends on the font size. But I have noticed that this only happens with split panes and also only on the left side. Also it seems everything works like I'd want it to in xterm and urxvt, so I may switch over to them – Patrick Ziegler Jul 13 '16 at 17:12
  • Also xinput gave me the same info as xev. – Patrick Ziegler Jul 13 '16 at 17:18
  • Admittedly, the term "smooth scrolling" is ambiguous (but still a good search term for what some mouse vendors call "frictionless", as it can also cover the "inertial" scrolling of touchpads and touchscreens). In some cases, it involves partial lines. For a terminal emulator, partial lines aren't desirable, but it could instead mean scrolling at different speeds, or varying the numbers of lines scrolled between refreshes. – JigglyNaga Jul 13 '16 at 20:10

1 Answers1

2

Smooth/frictionless/inertial scrolling is not supported by current tmux, mostly for reasons beyond its control.

tmux receives its mouse input through terminal control sequences, so it's limited by what the terminal gives it. A popular reference for terminal sequences is console_codes(4), but that doesn't mention the mouse wheel at all. However, XTerm control sequences does define some basic wheel sequences, so xterm-compatible terminals will also support those.

For now, tmux's handling of the mouse wheel expects only those two simple button events: "wheel up" and "wheel down". It also discards wheel release events (deliberately).

It's possible that future terminal emulators could introduce further escape sequences, such as wheel events that include a scroll size. If that happens (or if there's already one out there) then tmux would also need updating to recognize those sequences and handle them appropriately.

JigglyNaga
  • 7,706
  • 1
  • 21
  • 47