Skip to main content
ansicode

XTSMTITLE / XTRMTITLE — Set / reset title display modes (CSI > Ps ; … t / T)

Switch how xterm interprets / returns window-title and icon-name strings — hex vs UTF-8 encoding, truncation, set-vs-query behaviour.

Byte forms

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

\\x1b[\x1b[><Ps>;<Ps>…t (set) \x1b[><Ps>;<Ps>…T (reset)
\\033[\033[>2t / \033[>2T
\\e[\e[>2t / \e[>2T
ESC [ESC [ > Ps ; Ps … t / ESC [ > Ps ; Ps … T
hex1b 5b 3e ... 74 / 1b 5b 3e ... 54

Description

The `>` prefix disambiguates these from XTWINOPS (`CSI Ps ; Ps ; Ps t`, window resize / move / query) and from the SD / mouse-tracking final `T`. **XTSMTITLE** (`\x1b[><Ps>t`) toggles ON one or more title-display modes; **XTRMTITLE** (`\x1b[><Ps>T`) toggles OFF the same set. Each `Ps` selects a mode: `0` decode incoming OSC 0/1/2 title text as hex pairs (legacy escape for non-ASCII), `1` accept the title text as UTF-8 (xterm default since 2010s), `2` accept the icon name as UTF-8, `3` query replies (OSC 20 / 21 / GR 23 + XTWINOPS 21 / 20) return the title as UTF-8 instead of the bytes xterm actually has stored. Multiple `Ps` values can be combined in one sequence: `\x1b[>1;2t` flips both UTF-8 modes. Together with `OSC 0/1/2` (set title) and XTWINOPS 20/21 (query title) these knobs control the *encoding* round-trip. Most modern terminals default to UTF-8 already and these sequences are usually no-ops, but explicitly setting `>1;2t` is the safest portable warm-up before pushing a title containing non-ASCII characters.

Spec citation: xterm-ctlseqs (XTSMTITLE / XTRMTITLE)

Parameters

PsMode selector: `0` hex-decode incoming title, `1` UTF-8 window title, `2` UTF-8 icon name, `3` query replies in UTF-8. Multiple may be combined.

Examples

bash
# Opt in to UTF-8 for both title + icon name before pushing a non-ASCII title:\nprintf '\033[>1;2t'\nprintf '\033]0;\xe6\x9c\x80\xe6\x96\xb0\xe6\x97\xa5\xe5\xbf\x97\007'
python
import sys\nsys.stdout.write('\x1b[>1t')        # UTF-8 window title\nsys.stdout.write('\x1b]0;\u4e2d\u6587\x07')   # CJK title now decodes correctly
go
fmt.Print("\x1b[>1;2t")   // UTF-8 for title + icon\nfmt.Print("\x1b[>1;2T")   // and back to hex-only when done
javascript
process.stdout.write('\x1b[>3t')   // make query replies return UTF-8 strings
c
printf("\x1b[>1;2t");   /* before OSC 0;<utf8 title>;BEL */

Terminal support

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

Related sequences