Skip to content

OSC 0 / OSC 2 — Set Window Title

SequenceOSC <Ps> ; <title> ST
Ps0 = icon + window title, 1 = icon only, 2 = window only
Otty support

Description

Sets the window title (and optionally the icon title — Otty treats them as the same).

PsEffect
0Set icon name and window title
1Set icon name only
2Set window title only

The most common form is OSC 0. Most shell rcs (zsh precmd, bash PROMPT_COMMAND) emit this on every prompt to keep the tab label informative.

Example

bash
printf '\e]0;%s\a' "deploy-prod"
# zsh equivalent:
print -Pn "\e]0;%~\a"     # title = current directory (compact form)

Try it

otty features try set-title — sets both window (OSC 2) and icon/tab (OSC 1) names. Look at the title bar / tab to confirm.

Otty