OSC 99 Kitty Extensions
Text sizing, drag and drop, notifications and the clipboard, as kitty defines them.
OSC Ps ; metadata ; payload ST
- ECMA-48
- §8.3.89 OSC – Operating System Command, p. 51
- Specification
- Terminal protocol extensions, kitty documentation
The kitty terminal has defined several protocols of its own, each with a document of its own and most with the same shape, OSC Ps ; metadata ; payload ST, where the metadata is key=value pairs separated by :. Besides its keyboard protocol, its color protocol and its additions to OSC 22, these are the ones libghostty-vt recognizes:
| Sequence | Does | Defined in | libghostty-vt |
|---|---|---|---|
OSC 66 ; metadata ; text ST | draws text at a larger scale, s=2 for twice the size, or as part of a cell | Text sizing | ignored, and the text is not shown |
OSC 72 ; metadata ; payload ST | drag and drop between the terminal and a program; t=q asks for support | Drag and drop | handled through its host; answers t=q |
OSC 99 ; metadata ; payload ST | desktop notifications, with titles, icons, buttons and updates; p=? asks for support | Desktop notifications | ignored; p=? is not answered |
OSC 5522 ; metadata ; payload ST | the clipboard by MIME type, extending OSC 52; CSI ? 5522 $ p asks for support | Copying all data types to the clipboard | handled through its host’s clipboard callbacks |
How a program finds out whether a terminal has each one differs: OSC 66 by drawing a space with it between two cursor position reports and seeing whether the cursor moved further than one cell; OSC 72 and OSC 99 with their own questions; and OSC 5522 with DECRQM, a terminal without it answering 0.
A default xterm has none of these and ignores them (the OSC numbers it knows). The cases follow xterm. libghostty-vt answers two of them where a host has not taken them over: OSC 72 ; t=q with OSC 72 ; t=q ST, a terminal that supports drag and drop with nothing optional; and an OSC 5522 request with a status, EPERM for a read and ENOSYS for a write, though it answers the DECRQM for mode 5522 with 0. Those cases are known differences.
Validation
KITTYOSC-1: Text sizing draws nothing
A
\e]66;s=2;big\a
B
|AB____|
cursor 1,3
KITTYOSC-2: Notifications are not answered
\e]99;i=1:p=?;\e\\
\e]99;;Hello\e\\
|______|
reply none
KITTYOSC-3: Drag and drop
\e]72;t=q\e\\
|______|
reply none
KITTYOSC-4: The clipboard
\e]5522;type=write\a
|______|
reply none
KITTYOSC-5: The clipboard’s mode
\e[?5522$p
|______|
reply \e[?5522;0$y