Strovent SystemsSign in
Reference

Mouse hover doesn't work in a TUI over SSH, tmux or Mosh: mouse modes 1000, 1002 and 1003

Hover needs any-event mouse reporting (mode 1003), which reports movement with no button held. Find which layer drops it: your terminal, tmux or Mosh.

A full-screen program asks the terminal for mouse reports with a DEC private mode (DECSET, ESC [ ? n h). The xterm control sequences define the mouse modes:

| Mode | xterm name | Reports | |---|---|---| | 1000 | normal | button press and release | | 1002 | button-event (cell motion) | also movement while a button is held | | 1003 | any-event (all motion) | also movement with no button held | | 1006 | SGR mouse mode | a longer report format, not a reporting mode |

Hover effects need 1003. If a program's buttons and clicks work but hover does not, the program is getting 1000 or 1002 reports and no plain movement. Every layer between the program and your screen has to pass 1003 on.

Test each layer

Turn on any-event mode by hand and watch what arrives:

printf '\033[?1003h\033[?1006h'; cat -v

Move the mouse without clicking. Lines like ^[[<35;10;5M are movement reports. Press Ctrl+C, then turn the mode off again:

printf '\033[?1003l\033[?1006l'

Run this test in a plain SSH session first, then inside tmux, then over Mosh. The first layer where movement stops showing up is the one dropping it.

Your terminal

The terminal app on your side is what actually sees the mouse. If nothing arrives even in a plain SSH session, the terminal does not report movement without a button: look for a setting for mouse reporting, or try another terminal.

This app reports taps and drags to a program that asks for mouse reports, but it never reports movement with no button held, so hover effects do not work in it.

tmux

In the current tmux source, when the mouse option is on and a pane has asked for mode 1003, tmux asks your terminal for all-motion reports too. Otherwise it asks for button-event mode, which reports no hover, unless an option such as focus-follows-mouse needs movement reports. tmux also sends mouse modes to your terminal only if that terminal's terminfo entry has the kmous capability. Check with:

infocmp | grep -o 'kmous=[^,]*'

If the test works outside tmux but not inside, check that mouse is on (tmux show -g mouse), and that TERM outside tmux names a terminal type with kmous. See TERM and terminfo.

Mosh

Mosh 1.4.0 accepts modes 9 and 1000 to 1003 and the 1005, 1006 and 1015 report formats, and it sets the same mode on your terminal. Mosh added mouse modes in 1.2.5, so check that both ends are that version or newer. See Mosh scrollback is incomplete, and how to use the mouse.

Sources

Spotted a mistake? Email [email protected].