Skip to main content
ansicode

OSC 1 — Set icon name (separate from window title)

Set the X11-style icon name independent of the visible window title — historically the label shown when the window is minimised.

Byte forms

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

\\x1b[\x1b]1;ICON-NAME\x07
\\033[\033]1;ICON-NAME\007
\\e[\e]1;ICON-NAME\a
ESC [ESC ] 1 ; ICON-NAME BEL
hex1b 5d 31 3b ... 07

Description

OSC 1 sets the icon name — historically the short label X11 showed for a minimised window (versus OSC 2 which set the long title visible in the title bar). OSC 0 sets both at once; OSC 1 sets only the icon name; OSC 2 sets only the title. On X11/xterm + gnome-terminal + konsole + mlterm + foot this still works as designed — the window manager picks up the icon-name attribute via XSetWMIconName. On non-X11 terminals (Windows Terminal, iTerm2, kitty, alacritty, wezterm, ghostty) there is no separate icon-name surface to render to, so most ignore OSC 1 entirely or quietly treat it as a no-op. Use OSC 0 if you want both updated together (the safe default for cross-platform tools); use OSC 1 only when you specifically need to leave the title bar untouched while updating the minimised label.

Spec citation: xterm-ctlseqs (OSC 1)

Examples

bash
printf '\033]1;build-watch\007'   # icon name only; title bar untouched
python
import sys; sys.stdout.write('\x1b]1;build-watch\x07')
go
fmt.Print("\x1b]1;build-watch\x07")
javascript
process.stdout.write('\x1b]1;build-watch\x07')
c
printf("\x1b]1;build-watch\x07");

Used in

Real-world tools that emit this sequence — anchors the bytes to commands you've already used.

  • xterm, urxvt, gnome-terminal, konsole, mlterm, footall the X11-native terminals honour OSC 1 — the icon-name string is published as `WM_ICON_NAME` so the window manager can show a short label (`vim`, `htop`) in the taskbar / activities switcher while the title bar keeps the full `vim — ~/proj/foo.c`
  • tmux `set-titles-string` + `icon-string`tmux exposes a separate `icon-string` setting alongside `titles-string` — when the outer terminal is X11-native, tmux emits OSC 1 with the short form (`#W`) for the icon and OSC 2 with the long form (`#S:#W -- #T`) for the title, mirroring the xterm convention
  • screen `caption` / `hardstatus`GNU screen, when run inside an xterm-family terminal, emits OSC 1 every time the focused window changes — so an Alt-Tab style switcher shows the inner window's name (`screen 0: vim`) instead of the static outer label
  • i3wm / sway / xmonad — minimised icon labelstiling WMs that fall back to floating layouts (i3 scratchpad, sway `move workspace`) display the icon-name when a window is minimised or moved to a non-visible workspace — emitting OSC 1 from a long job (`make all 2>&1 | tee >(grep -q ERROR && printf '\\x1b]1;BUILD FAILED\\x07')`) makes the workspace tab flash a meaningful label
  • non-X11 terminals (iTerm2, kitty, alacritty, wezterm, ghostty, Windows Terminal)none of them render a separate icon surface — OSC 1 is parsed and dropped (or treated as OSC 0 in some builds). Portable scripts should send OSC 0 (`\x1b]0;<name>\x07`) to update both icon and title at once unless the X11 split is explicitly required

Frequently asked

Short answers to the questions developers actually search for this sequence.

What's the difference between OSC 0, OSC 1, and OSC 2 — why three title escapes?
OSC 0 sets BOTH the icon name AND the window title in one call (shorthand). OSC 1 sets *only* the icon name (the short label shown when the window is minimized / iconified). OSC 2 sets *only* the window title (the long string in the title bar / tab label). The split dates to X11 / ICCCM where iconified windows displayed a separate compact label. On modern terminals without iconification (Windows Terminal, macOS Terminal.app, kitty), OSC 1 is often silently no-op'd; OSC 0 and OSC 2 still work everywhere. For SSH-into-server tab labels, use OSC 2 — OSC 0 risks clobbering the icon on terminals that still honour the X11 distinction.
Why does my icon name change reset every time I open a new tab in tmux?
tmux maintains its own per-window icon name and re-emits OSC 1 to the outer terminal whenever the active window changes. Setting OSC 1 from inside an inner shell updates the *tmux window's* recorded icon name, but the moment you Ctrl-b n to the next window, tmux pushes that window's saved icon (often empty → terminal falls back to the binary name like tmux). To keep an icon across windows, set set-option -g set-titles-string '#W' and let tmux drive the title from the inner shell's automatic-rename mechanism — manual OSC 1 from one window can't persist beyond the next window switch.

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
yes
Konsole
yes
tmux
yes
GNU screen
yes

Related sequences

In the family cookbook

OSC cookbook · 2. Window & tab titles — `OSC 0 / 1 / 2`