OSC 22
OSC 22 sets the shape of the mouse pointer cursor when it hovers over the terminal window. This allows terminal applications to provide visual feedback about interactive regions, similar to how web pages change the cursor to a hand pointer over clickable elements.
Syntax
OSC 22 ; shape ST
OSC 22 ; shape BEL
OSC22 = 0x1b, "]", "22", ";", shape, ( 0x07 | 0x1b, "\\" ) ;
shape = letter, { letter | "-" } ;
letter = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j"
| "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t"
| "u" | "v" | "w" | "x" | "y" | "z" ;Parameters
| Parameter | Description | Default |
|---|---|---|
shape | The cursor shape name | (required) |
Common cursor shape values follow CSS cursor naming conventions:
| Shape | Description |
|---|---|
default | The platform default cursor (usually an arrow) |
text | Text selection cursor (I-beam) |
pointer | Hand/pointing cursor (indicates a link or clickable element) |
crosshair | Crosshair cursor (precision selection) |
help | Help cursor (arrow with question mark) |
progress | Busy cursor with background activity indicator |
wait | Busy/loading cursor (hourglass or spinner) |
move | Move/drag cursor (four-directional arrows) |
not-allowed | Prohibited action cursor (circle with slash) |
grab | Open hand cursor (before grabbing) |
grabbing | Closed hand cursor (while dragging) |
Description
Per the XTerm control sequences documentation, OSC 22 changes the mouse pointer cursor shape. The shape name follows CSS cursor naming conventions, making the values familiar to web developers.
This sequence enables TUI applications to provide richer mouse interaction feedback. For example, a terminal-based file manager could change the cursor to pointer when hovering over a clickable item, or a terminal drawing application could use crosshair for precision drawing mode.
Setting the shape to default restores the standard cursor appearance. The cursor shape reverts to the default when the application exits or when the terminal is reset.
The set of supported cursor shapes varies between terminals. Most terminals support at least default, text, and pointer. Some terminals may accept X11 cursor font names in addition to CSS cursor names.
Examples
# Set cursor to pointer (hand)
printf '\e]22;pointer\e\\'
# Set cursor to crosshair
printf '\e]22;crosshair\a'
# Set cursor to text selection (I-beam)
printf '\e]22;text\e\\'
# Reset to default cursor
printf '\e]22;default\e\\'
# Set cursor to not-allowed (prohibition sign)
printf '\e]22;not-allowed\a'
Specifications
| Specification | Section |
|---|---|
| XTerm ctlseqs | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✗ | No | Not listed in escape_support.md OSC section |
| Bobcat | ? | ? | Would be handled by underlying TerminalCtrl library, not directly in Bobcat code |
| contour | ✗ | No | Not implemented - no OSC 22 handler found |
| foot | ✓ | Yes | Set mouse cursor shape, osc.c:1498-1500 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | Mouse pointer shape via set_dynamic_color |
| Konsole | ✓ | Yes | PointerShape enum value 22 in src/Vt102Emulation.h:192 |
| mintty | ✓ | Yes | Implemented at termout.c:4864-4867, set mouse pointer cursor style |
| mlterm | ✗ | No | |
| PuTTY | ✗ | No | Not implemented in do_osc function |
| Rio | ✓ | v0.0.17 | Sets mouse pointer cursor shape using CursorIcon enum |
| rxvt-unicode | ✗ | No | Only OSC 13/14 for pointer fg/bg colors, not OSC 22 |
| st | ✗ | No | |
| terminology | ✗ | No | |
| VT100 | ✗ | No | |
| VTE | ✗ | No | OSC 22 listed as unsupported in vteseq.cc case statement |
| WezTerm | ✗ | No | OSC 22 (mouse pointer cursor shape) not found in codebase |
| Windows Terminal | ✗ | No | Not in OscActionCodes enum; no mouse pointer shape handling found |
| xterm | ✓ | Yes | OSC 22 changes pointer cursor shape via pointerShape resource (OSC_SetupPointer=22 in misc.c:3487) |
| xterm.js | ✗ | No | Not implemented |
| Multiplexers | |||
| cy | ✗ | No | |
| GNU Screen | ✗ | No | |
| tmux | ✗ | No | Mouse pointer cursor shape not implemented |
| tuios | ✗ | No | |
| Zellij | ✗ | No | |
See also
- OSC 8 — Hyperlinks — Clickable links that often trigger a pointer cursor change automatically