# rxvt-unicode Extensions (OSC 777)

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

- **Sequence:** `OSC 777 ; prefix ; Pt ST`
- **ECMA-48:** [§8.3.89 OSC – Operating System Command, p. 51](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n64/mode/1up)
- **Specification:** [urxvtperl, rxvt-unicode's Perl extension manual](https://manpages.debian.org/testing/rxvt-unicode/urxvtperl.3.en.html#on_osc_seq_perl)

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](https://manpages.debian.org/testing/rxvt-unicode/urxvtperl.3.en.html#on_osc_seq_perl)
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](https://control-codes.page/osc/notify/index.html.md) has.

A default xterm has no `OSC 777` and ignores it
([the OSC numbers it knows](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L3476-L3504)).
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.

## Validation

### OSC777-1: A notification changes nothing on screen

Input, one step per line:

```text
A
\e]777;notify;make;Build finished\a
B
```

Expected screen:

```text
|AB____|
cursor 1,3
reply none
bell 0
```

### OSC777-2: Nor does a command for another extension

Input, one step per line:

```text
A
\e]777;myext;hello\a   # for an extension called myext
B
```

Expected screen:

```text
|AB____|
cursor 1,3
reply none
```

---

This is the Markdown version of <https://control-codes.page/osc/rxvt/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.

The validation cases are written in the notation described in <https://control-codes.page/notation/index.html.md>.
