DECSET ?1000 / ?1006 — Mouse tracking
Receive mouse click / drag / scroll events as escape sequences.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[?1000h (click only) \x1b[?1002h (cell drag) \x1b[?1003h (any motion) \x1b[?1006h (SGR encoding)\\033[
\033[?1000h …\\e[
\e[?1000h …ESC [
ESC [ ? <N> h / lhex
1b 5b 3f ... 68 / 6cDescription
Mouse reporting modes are stackable on/off DEC private modes. `?1000` reports button press+release, `?1002` adds drag events while a button is held, `?1003` reports every motion. The encoding sub-modes are `?1005` (UTF-8, deprecated), `?1015` (urxvt), and `?1006` (SGR — recommended, no 223-column limit, ASCII-safe). Enable `?1006` alongside `?1000`/`?1002` for portable handling. Disable everything with `?1000l ?1002l ?1003l ?1006l` on exit — a forgotten enable will spam your shell with `^[[<…` strings.
Spec citation: xterm-ctlseqs (Mouse Tracking)
Examples
printf '\033[?1000h\033[?1006h' # enable click+SGR\nprintf '\033[?1000l\033[?1006l' # disableimport sys; sys.stdout.write('\x1b[?1000h\x1b[?1006h')fmt.Print("\x1b[?1000h\x1b[?1006h")process.stdout.write('\x1b[?1000h\x1b[?1006h')printf("\x1b[?1000h\x1b[?1006h");Terminal support
- xterm
- yes
- Linux console (fbcon)
- partial
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- partial
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | partial | yes | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |