Skip to main content

Title stack

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

Title Stack provides XTerm window manipulation sequences for pushing and popping window and icon titles on a stack, allowing applications to save and restore the terminal's title.

Syntax​

CSI 22 ; Ps t     Push title to stack
CSI 23 ; Ps t Pop title from stack
Formal syntax
push_title = 0x1b, "[", "2", "2", ";", Ps, "t" ;
pop_title  = 0x1b, "[", "2", "3", ";", Ps, "t" ;
Ps         = "0" | "1" | "2" ;

Parameters​

ValueDescription
0Push or pop both the icon title and the window title
1Push or pop the icon title only
2Push or pop the window title only

Description​

These sequences manage a stack of window and icon titles, allowing applications to save the current title before changing it and restore the original title afterward. They are part of the XTerm CSI Ps ; Ps ; Ps t window manipulation family.

  • CSI 22 ; Ps t (Push) — Saves the current title(s) onto an internal stack. The title can then be changed freely using OSC 0 or OSC 2, knowing it can be restored later.
  • CSI 23 ; Ps t (Pop) — Restores the most recently pushed title(s) from the stack and sets them as the current title(s). If the stack is empty, the operation has no effect.

The Ps parameter controls which titles are affected:

PsPush behaviorPop behavior
0Saves both the icon and window titleRestores both titles
1Saves the icon title onlyRestores the icon title only
2Saves the window title onlyRestores the window title only

The title stack is particularly useful for applications that temporarily change the terminal title (for example, to display a filename or status) and need to restore the user's original title upon exit. Using the stack avoids the need for the application to query and store the original title itself.

The stack operates in a last-in, first-out (LIFO) manner. Multiple push operations can be performed before popping, and each pop restores the most recently pushed value.

Examples​

# Save both titles, change title, then restore
printf '\e[22;0t' # Push current titles
printf '\e]2;My Application\a' # Set new window title
# ... application runs ...
printf '\e[23;0t' # Restore original titles

# Save only the window title
printf '\e[22;2t' # Push window title
printf '\e]2;Working...\a' # Set temporary title
printf '\e[23;2t' # Restore window title

Specifications​

SpecificationSection
XTerm ctlseqs—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesImplemented via push_title()/pop_title() at term/mod.rs:2235,2249. Max stack depth: 4096 (TITLE_STACK_MAX_DEPTH)
Bobcat✓0.9.0Handled by TerminalCtrl library
contour✓v0.1.0
foot~YesImplemented at csi.c:1392-1413, only handles title (param 0 or 2), ignores icon label (param 1)
Ghostty✓v1.0.0Only supports window title (params[1] = 0 or 2), not icon title
iTerm2✓YesBoth push (CSI 22 t) and pop (CSI 23 t) implemented with parameter support: 0=both, 1=icon, 2=window. See VT100Terminal.m:2793-2819
Kitty✓YesPush/pop window title stack with maxlen=10
Konsole✗NoExplicitly ignored with comment in code (src/Vt102Emulation.cpp:2014-2015)
mintty✓YesFull push/pop stack for window titles via CSI 22/23 t, implemented in src/termout.c:3059-3064 with stack management in src/winmain.c:1439-1464
mlterm~3.9.2When icon and window titles are pushed together (ps[1]=0), popping either one doesn't pop the other as xterm does. See XtermWinopsTests in esctest.
PuTTY✗NoNot implemented; no case 22 or 23 handlers in window manipulation code
Rio✓v0.0.28
rxvt-unicode✗NoNot implemented; no CSI 22/23 t handlers for push/pop title stack
st✗No
terminology✓v1.7.0
VT100✗No
VTE~YesOnly supports window title (CSI 22;0 t / CSI 22;2 t); icon title stack (CSI 22;1 t) not implemented. Max stack depth: 8
WezTerm✗NoParser recognizes sequences but handler is empty (no-op) at term/src/terminalstate/mod.rs:2090-2095
Windows Terminal✗NoNot present in WindowManipulationType enum; only values 1,2,7,8,14,16,18 are supported
xterm✓xterm-406Requires OPT_TITLE_MODES compile flag (enabled by default)
xterm.js✓4.4.0Requires windowOptions.pushTitle and windowOptions.popTitle to be enabled
Multiplexers
cy✗NoCSI t (XTWINOPS) explicitly ignored since v0.1.0
GNU Screen✗NoCSI 22/23 t not implemented; no title stack functionality
tmux✓2.7Supports both CSI 22 t (push) and CSI 23 t (pop)
tuios✗NoOnly CSI 14/16/18 t are implemented in XTWINOPS handler
Zellij✓v0.16.0

See also​