# Kitty's Other OSCs (OSC 66, OSC 72, OSC 99, OSC 5522)

> Text sizing, drag and drop, notifications and the clipboard, as kitty defines them.

- **Sequence:** `OSC Ps ; metadata ; payload 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:** [Terminal protocol extensions, kitty documentation](https://sw.kovidgoyal.net/kitty/protocol-extensions/)

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](https://control-codes.page/csi/kitty-keyboard/index.html.md),
its [color protocol](https://control-codes.page/osc/kitty-color/index.html.md) and its additions to
[OSC 22](https://control-codes.page/osc/pointer/index.html.md), 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](https://sw.kovidgoyal.net/kitty/text-sizing-protocol/) | 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](https://sw.kovidgoyal.net/kitty/dnd-protocol/) | 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](https://sw.kovidgoyal.net/kitty/desktop-notifications/) | ignored; `p=?` is not answered |
| `OSC 5522 ; metadata ; payload ST` | the clipboard by MIME type, extending [OSC 52](https://control-codes.page/osc/clipboard/index.html.md); `CSI ? 5522 $ p` asks for support | [Copying all data types to the clipboard](https://sw.kovidgoyal.net/kitty/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](https://control-codes.page/csi/dsr/index.html.md) and seeing whether the cursor moved
further than one cell; `OSC 72` and `OSC 99` with their own questions; and
`OSC 5522` with [DECRQM](https://control-codes.page/csi/decrqm/index.html.md), a terminal without it answering `0`.

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

Input, one step per line:

```text
A
\e]66;s=2;big\a
B
```

Expected screen:

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

### KITTYOSC-2: Notifications are not answered

Input, one step per line:

```text
\e]99;i=1:p=?;\e\\
\e]99;;Hello\e\\
```

Expected screen:

```text
|______|
reply none
```

### KITTYOSC-3: Drag and drop

*A known difference: libghostty-vt does not pass this case.*

Input, one step per line:

```text
\e]72;t=q\e\\
```

Expected screen:

```text
|______|
reply none
```

### KITTYOSC-4: The clipboard

*A known difference: libghostty-vt does not pass this case.*

Input, one step per line:

```text
\e]5522;type=write\a
```

Expected screen:

```text
|______|
reply none
```

### KITTYOSC-5: The clipboard's mode

Input, one step per line:

```text
\e[?5522$p
```

Expected screen:

```text
|______|
reply \e[?5522;0$y
```

---

This is the Markdown version of <https://control-codes.page/osc/kitty/>. 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>.
