^[control-codes
live in libghostty-vt

Operating system commands

OSC 777 Perl Extension Command

View as Markdown

Pass a string to one of rxvt-unicode's Perl extensions; with the prefix notify, show a desktop notification.

OSC 777 ; prefix ; Pt ST
ECMA-48
§8.3.89 OSC – Operating System Command, p. 51
Specification
urxvtperl, rxvt-unicode's Perl extension manual

rxvt-unicode can be extended with Perl, and OSC 777 is how a program talks to an extension: OSC 777 ; prefix ; Pt ST hands Pt to the extension that registered prefix, and to nothing else. Its definition is the on_osc_seq_perl hook in rxvt-unicode’s urxvtperl manual, which asks that the prefix be the extension’s name, so that extensions do not take each other’s commands. What a command does is up to its extension; a terminal without that extension does nothing with it.

One prefix has spread beyond rxvt-unicode. Several terminals, Ghostty among them, take OSC 777 ; notify ; title ; body ST as a request to show a desktop notification, with a title as well as the body that iTerm2’s OSC 9 has.

A default xterm has no OSC 777 and ignores it (the OSC numbers it knows). The cases follow xterm.

libghostty-vt recognizes only the notify prefix, and passes the title and body to its host through the DESKTOP_NOTIFICATION callback, which the runner does not install; any other prefix is ignored. What a case can see is that nothing is printed, answered or rung, 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-vt0f171f6Partlyonly the notify prefix, passed to the host’s DESKTOP_NOTIFICATION callback
Konsole26.11.70, a24c3d71Partlyonly notify and its own container prefix
ConEmubuild 230724, its documentationNonot in its ANSI escape codes
rxvt-unicode9.31, urxvtperl(3)Yeshands it to the Perl extension that registered the prefix: urxvtperl

Validation

OSC777-1: A notification changes nothing on screen

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

OSC777-2: Nor does a command for another extension

A
\e]777;myext;hello\a   # for an extension called myext
B
|AB____|
cursor 1,3
reply none
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.