Skip to main content

Any-event mouse

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Experimental

Any-Event Mouse Tracking (Mode 1003) is a DECSET/DECRST mode that reports all mouse events, including motion with no buttons pressed.

Syntax​

CSI ? 1003 h    DECSET — Enable any-event mouse tracking
CSI ? 1003 l DECRST — Disable any-event mouse tracking
Formal syntax
DECSET-mode1003 = 0x1b, "[", "?", "1", "0", "0", "3", "h" ;
DECRST-mode1003 = 0x1b, "[", "?", "1", "0", "0", "3", "l" ;

Description​

Mode 1003 is an XTerm extension that enables the most verbose level of mouse tracking. When enabled, the terminal reports every mouse event: button presses, releases, and all motion, including motion with no buttons held.

  • Set — The terminal reports all mouse events, including passive motion.
  • Reset — Mouse events are not reported. The terminal handles mouse events normally. This is the default.

Report format​

Any-event tracking uses the same report format as Modes 1000 and 1002:

CSI M Cb Cx Cy

Where:

  • Cb is the button/event byte: the button number plus modifier flags, plus 32
  • Cx is the column (x coordinate) plus 32
  • Cy is the row (y coordinate) plus 32

For motion events with no button held, the report uses button value 3 (which normally means "release") with the motion flag (bit 5) set, resulting in Cb - 32 = 35.

Traffic considerations​

Mode 1003 generates a report for every cell the mouse cursor crosses, which can produce a substantial volume of input data. For a user moving the mouse across a large terminal, this can mean hundreds of reports per second. Applications should:

  • Process mouse events efficiently to avoid input buffer overflow
  • Consider Mode 1002 if only drag tracking is needed
  • Disable Mode 1003 promptly when no longer needed
note

Mode 1003 mutually excludes other mouse tracking modes. Enabling it implicitly disables Mode 1000 and Mode 1002.

Examples​

printf '\e[?1003h'   # Enable any-event mouse tracking
printf '\e[?1003l' # Disable any-event mouse tracking

# Combine with SGR encoding for large terminals:
printf '\e[?1003h\e[?1006h' # Enable any-event tracking + SGR encoding
printf '\e[?1006l\e[?1003l' # Disable both (reverse order)

Specifications​

SpecificationSection
XTerm ctlseqs—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓Yes
Bobcat✓0.9.0Implemented in TerminalCtrl library. README states 'Full Mouse & Keyboard Support across all major protocols'.
contour✓v0.3.0.198Implemented as DECMode::MouseProtocolAnyEventTracking, handled in Terminal.cpp:2405
foot✓Yes
Ghostty✓v1.0.0
iTerm2✓v20260216-nightly
Kitty✓Yes
Konsole✓YesMODE_Mouse1003 for all motion tracking
mintty✓YesImplemented at src/termout.c:2493
mlterm✓rel-0_2_1Present since initial public release
PuTTY✓0.52
Rio✓v0.1.13
rxvt-unicode✓8.4
st✓0.5
terminology✓v0.2.0Sets mouse_mode to MOUSE_NORMAL_ALL_MOVE
VT100✗No
VTE✓Yes
WezTerm✓Yes
Windows Terminal✓YesANY_EVENT_MOUSE_MODE at adaptDispatch.cpp:1853-1855
xterm✓YesAny-event mouse tracking
xterm.js✓0.3
Multiplexers
cy✓Yes
GNU Screen✓v.4.2.0Present since at least v.4.0.2 (2005)
tmux✓1.7
tuios✓v0.0.15
Zellij✓v0.31.2

See also​