# 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.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | No | OSC is not among the controls it recognizes ([§4.2](https://vt100.net/docs/vt220-rm/chapter4.html#S4.2)) |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | No | ignores an OSC string ([chapter 4](https://vt100.net/docs/vt510-rm/chapter4.html)) |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | No | ignored |
| libghostty-vt | [0f171f6](https://github.com/ghostty-org/ghostty/tree/0f171f650a1cbbd6df4a2573b6b0c7de57cc6d90) | Partly | only the `notify` prefix, passed to the host's `DESKTOP_NOTIFICATION` callback |
| Konsole | 26.11.70, [a24c3d71](https://invent.kde.org/utilities/konsole/-/tree/a24c3d71be3684f24d030aa2dbe9bd723d985233) | Partly | only `notify` and its own `container` prefix |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in its [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |
| rxvt-unicode | 9.31, [`urxvtperl(3)`](https://manpages.debian.org/testing/rxvt-unicode/urxvtperl.3.en.html) | Yes | hands it to the Perl extension that registered the prefix: [urxvtperl](https://manpages.debian.org/testing/rxvt-unicode/urxvtperl.3.en.html#on_osc_seq_perl) |

## 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>.
