Skip to main content

OSC 22

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

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
Formal syntax
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​

ParameterDescriptionDefault
shapeThe cursor shape name(required)

Common cursor shape values follow CSS cursor naming conventions:

ShapeDescription
defaultThe platform default cursor (usually an arrow)
textText selection cursor (I-beam)
pointerHand/pointing cursor (indicates a link or clickable element)
crosshairCrosshair cursor (precision selection)
helpHelp cursor (arrow with question mark)
progressBusy cursor with background activity indicator
waitBusy/loading cursor (hourglass or spinner)
moveMove/drag cursor (four-directional arrows)
not-allowedProhibited action cursor (circle with slash)
grabOpen hand cursor (before grabbing)
grabbingClosed 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.

note

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​

SpecificationSection
XTerm ctlseqs—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✗NoNot listed in escape_support.md OSC section
Bobcat??Would be handled by underlying TerminalCtrl library, not directly in Bobcat code
contour✗NoNot implemented - no OSC 22 handler found
foot✓YesSet mouse cursor shape, osc.c:1498-1500
Ghostty✓v1.0.0
iTerm2✓v20260216-nightly
Kitty✓YesMouse pointer shape via set_dynamic_color
Konsole✓YesPointerShape enum value 22 in src/Vt102Emulation.h:192
mintty✓YesImplemented at termout.c:4864-4867, set mouse pointer cursor style
mlterm✗No
PuTTY✗NoNot implemented in do_osc function
Rio✓v0.0.17Sets mouse pointer cursor shape using CursorIcon enum
rxvt-unicode✗NoOnly OSC 13/14 for pointer fg/bg colors, not OSC 22
st✗No
terminology✗No
VT100✗No
VTE✗NoOSC 22 listed as unsupported in vteseq.cc case statement
WezTerm✗NoOSC 22 (mouse pointer cursor shape) not found in codebase
Windows Terminal✗NoNot in OscActionCodes enum; no mouse pointer shape handling found
xterm✓YesOSC 22 changes pointer cursor shape via pointerShape resource (OSC_SetupPointer=22 in misc.c:3487)
xterm.js✗NoNot implemented
Multiplexers
cy✗No
GNU Screen✗No
tmux✗NoMouse pointer cursor shape not implemented
tuios✗No
Zellij✗No

See also​