^[control-codes live in libghostty-vt

Operating system commands

OSC 9 Desktop Notification

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

Two sequences ask the terminal to show a notification on the desktop, for instance when a long build finishes:

SequenceFromShows
OSC 9 ; Pt STiTerm2, in its escape code documentationPt as the notification’s text
OSC 777 ; notify ; Pt ; Pb STrxvt-unicode’s notify extensiona title Pt and a body Pb

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.

None of these is xterm’s, and a default xterm ignores them (the OSC numbers it knows). The cases follow xterm.

libghostty-vt parses both, and passes them to its host through the DESKTOP_NOTIFICATION callback, which the runner does not install. What a case can see is that neither prints anything, answers, or rings the bell, and libghostty-vt passes those.

Validation

OSC9-1: A notification changes nothing on screen

A
\e]9;Build finished\a
\e]777;notify;make;Build finished\a
B
|AB____|
cursor 1,3
reply none
bell 0