Skip to main content
ansicode

XTWINOPS — Window manipulation (CSI Ps ; Ps ; Ps t)

xterm's window-manipulation family — resize, minimise, raise/lower, query size, push/pop title.

Byte forms

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

\\x1b[\x1b[<Ps>t or \x1b[<Ps>;<Pa>;<Pb>t
\\033[\033[18t
\\e[\e[18t
ESC [ESC [ Ps ; Pa ; Pb t
hex1b 5b ... 74

Description

Dispatches by first parameter `Ps`. Common operations: `1` de-iconify, `2` iconify, `3;x;y` move window to (x,y) pixels, `4;h;w` resize to (h,w) pixels, `5` raise window, `6` lower window, `7` refresh, `8;rows;cols` resize text area to (rows,cols), `9;0` un-maximise, `9;1` maximise, `10;0` un-fullscreen, `10;1` fullscreen, `11` report iconified state (`\x1b[1t` / `\x1b[2t`), `13` report window position, `14` report pixel size, `18` report text size (`\x1b[8;rows;colst`), `19` report screen size in chars, `20` report icon title, `21` report window title, `22;0` push BOTH title types, `22;1` push icon title, `22;2` push window title, `23;0`/`23;1`/`23;2` pop. Many operators (`3`/`4`/`8`/`9`/`10`/`13`/`14`/`20`/`21`) are gated by xterm's `allowWindowOps` resource for security — most modern terminals ship that disabled, so resize/move requests silently no-op and only the queries (`14`, `18`, `21`) reliably round-trip. The push/pop title pair (`22`/`23`) is the most portable use and underpins tmux's window-name preservation across nested sessions.

Spec citation: xterm-ctlseqs (XTWINOPS) / DECSLPP partial overlap

Parameters

PsOperation selector (1–23). Some operators take additional Pa / Pb parameters.

Examples

bash
# Query pixel size — reply: \x1b[4;height;widtht\nprintf '\033[14t'
python
import sys; sys.stdout.write('\x1b[18t'); sys.stdout.flush()  # reply: \x1b[8;rows;colst
go
fmt.Print("\x1b[22;0t")   // push BOTH titles
javascript
process.stdout.write('\x1b[23;0t')  // pop BOTH titles
c
printf("\x1b[8;24;80t");  // resize text area to 24 rows × 80 cols (allowWindowOps required)

Terminal support

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

Related sequences