Any-event mouse
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
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:
Cbis the button/event byte: the button number plus modifier flags, plus 32Cxis the column (x coordinate) plus 32Cyis 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
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
| Specification | Section |
|---|---|
| XTerm ctlseqs | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | |
| Bobcat | ✓ | 0.9.0 | Implemented in TerminalCtrl library. README states 'Full Mouse & Keyboard Support across all major protocols'. |
| contour | ✓ | v0.3.0.198 | Implemented as DECMode::MouseProtocolAnyEventTracking, handled in Terminal.cpp:2405 |
| foot | ✓ | Yes | |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | |
| Konsole | ✓ | Yes | MODE_Mouse1003 for all motion tracking |
| mintty | ✓ | Yes | Implemented at src/termout.c:2493 |
| mlterm | ✓ | rel-0_2_1 | Present since initial public release |
| PuTTY | ✓ | 0.52 | |
| Rio | ✓ | v0.1.13 | |
| rxvt-unicode | ✓ | 8.4 | |
| st | ✓ | 0.5 | |
| terminology | ✓ | v0.2.0 | Sets mouse_mode to MOUSE_NORMAL_ALL_MOVE |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | |
| WezTerm | ✓ | Yes | |
| Windows Terminal | ✓ | Yes | ANY_EVENT_MOUSE_MODE at adaptDispatch.cpp:1853-1855 |
| xterm | ✓ | Yes | Any-event mouse tracking |
| xterm.js | ✓ | 0.3 | |
| Multiplexers | |||
| cy | ✓ | Yes | |
| GNU Screen | ✓ | v.4.2.0 | Present since at least v.4.0.2 (2005) |
| tmux | ✓ | 1.7 | |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.31.2 | |
See also
- Normal Mouse Tracking — Mode 1000 — Press and release tracking only
- Button-Event Mouse Tracking — Mode 1002 — Motion while button is held
- SGR Mouse Encoding — Mode 1006 — Extended encoding without coordinate limits
- SGR-Pixel Mouse — Mode 1016 — Pixel-level mouse coordinates