^[control-codes
live in libghostty-vt

Operating system commands

OSC 9 Desktop Notification

View as Markdown

Ask the terminal to show a desktop notification.

OSC 9 ; Pt ST
ECMA-48
§8.3.89 OSC – Operating System Command, p. 51
Specification
Post a notification, iTerm2 documentation

OSC 9 ; Pt ST asks the terminal to show Pt in a notification on the desktop, for instance when a long build finishes. It is iTerm2’s, in its escape code documentation. A notification with a title as well is OSC 777 ; notify ; title ; body ST, and kitty has its own, richer OSC 99.

OSC 9 is also used by ConEmu, on Windows, for its own commands, each a number after the 9, the best known of which is the progress report, OSC 9 ; 4. A terminal that has both tells them apart by what follows the 9: one of ConEmu’s numbers and a ;, or text.

It is not xterm’s, and a default xterm ignores it (the OSC numbers it knows). The cases follow xterm.

libghostty-vt passes it to its host through the DESKTOP_NOTIFICATION callback, which the runner does not install. What a case can see is that it prints nothing, answers nothing and does not ring the bell, and libghostty-vt passes.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984NoOSC is not among the controls it recognizes (§4.2)
VT510manual, 1st ed., 1993Noignores an OSC string (chapter 4)
xtermpatch 412, xterm-411aNoignored
libghostty-vt0f171f6Yespassed to the host’s DESKTOP_NOTIFICATION callback
Konsole26.11.70, a24c3d71Noits OSC 9 handling acts only on ConEmu’s 9 ; 4
iTerm23.7.3, its documentationYesProprietary Escape Codes
ConEmubuild 230724, its documentationNoits OSC 9 is followed by a command number; no notification in its ANSI escape codes

Validation

OSC9-1: A notification changes nothing on screen

A
\e]9;Build finished\a
B
|AB____|
cursor 1,3
reply none
bell 0
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.