Skip to main content
ansicode

OSC 22 — Set X11 mouse pointer / cursor name

Override the mouse-pointer glyph the terminal window draws — historically xterm-specific, exposed via standard X cursor names.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b]22;CURSOR-NAME\x07
\\033[\033]22;CURSOR-NAME\007
\\e[\e]22;CURSOR-NAME\a
ESC [ESC ] 22 ; CURSOR-NAME BEL
hex1b 5d 32 32 3b ... 07

Description

OSC 22 sets the X-server cursor name for the terminal window — the mouse pointer glyph the user sees when hovering over the terminal. The argument is one of the standard X cursor names (xcursor library): `xterm` (the I-beam — default), `crosshair`, `hand2`, `watch`, `wait`, `pirate`, `pencil`, etc. Used by full-screen TUI applications that want to signal mode changes via cursor shape (e.g. `pirate` while a long operation runs, `xterm` when input is accepted), or by terminal-based games. Strictly xterm-specific historically — the OSC body is passed straight to `XDefineCursor` so it only makes sense on X11-backed terminals. Non-X11 terminals universally ignore. Empty argument (`\x1b]22;\x07`) resets to the user's default pointer.

Spec citation: xterm-ctlseqs (OSC 22)

Examples

bash
printf '\033]22;watch\007'     # show a wait-cursor while a long job runs\nsleep 5\nprintf '\033]22;xterm\007'     # restore I-beam
python
import sys; sys.stdout.write('\x1b]22;watch\x07')
go
fmt.Print("\x1b]22;watch\x07")
javascript
process.stdout.write('\x1b]22;watch\x07')
c
printf("\x1b]22;watch\x07");

Terminal support

xterm
yes
Linux console (fbcon)
no
macOS Terminal.app
no
iTerm2
no
Windows Terminal
no
cmd.exe / ConPTY
no
kitty
no
alacritty
no
WezTerm
no
Ghostty
no
GNOME Terminal
no
Konsole
no
tmux
no
GNU screen
no

Related sequences