# Terminal Properties (OSC 666)

> Set, reset or signal VTE's typed terminal properties, which the program embedding VTE can watch.

- **Sequence:** `OSC 666 ; 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:** [Terminal properties, VTE source](https://gitlab.gnome.org/GNOME/vte/-/blob/0.84.1/src/vtegtk.cc#L2732)

`OSC 666` is VTE's, the library inside GNOME Terminal and others, from
0.78. It sets *termprops*: named, typed variables, a boolean, an integer, a
color, a string, a URI and so on, which the application embedding VTE
watches through a signal. `Pt` is one or more statements separated by `;`:

| Statement | Effect |
| --- | --- |
| `name=value` | set it |
| `name` | reset it; a name ending in `.` resets every one with that prefix |
| `name!` | signal a termprop that has no value |
| `name?` | query it |

Only registered names do anything, and a value of the wrong type resets
the termprop. A program's own termprops are named `vte.ext.` and the
terminal's name; VTE's own include `vte.cwd`, the shell's `vte.shell.precmd`,
`preexec` and `postexec`, and `vte.progress.hint` and `vte.progress.value`.
For now the answer to a query is always an empty `OSC 666 ST`, whatever was
asked, for security. VTE accepts the sequence only when it ends with ST, not
BEL, and [RIS](https://control-codes.page/esc/ris/index.html.md), [DECSTR](https://control-codes.page/csi/decstr/index.html.md) and DECSR reset every
termprop. VTE documents it in its source rather than its published reference
([`vtegtk.cc`](https://gitlab.gnome.org/GNOME/vte/-/blob/0.84.1/src/vtegtk.cc#L2732),
[`vteseq.cc`](https://gitlab.gnome.org/GNOME/vte/-/blob/0.84.1/src/vteseq.cc#L1862)).

A default xterm has no `OSC 666` 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 does not recognize `OSC 666` either: its OSC parser in
`osc.zig` has no state for the number, so the string is dropped, and the
cases pass.

## 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 | [83edd49](https://github.com/ghostty-org/ghostty/tree/83edd491e3024ae5e50393d62877b8897da1cccd) | No | ignored |
| Konsole | 26.11.70, [a24c3d71](https://invent.kde.org/utilities/konsole/-/tree/a24c3d71be3684f24d030aa2dbe9bd723d985233) | No | not among the OSC numbers it handles ([`Vt102Emulation.h`](https://invent.kde.org/utilities/konsole/-/blob/a24c3d71be3684f24d030aa2dbe9bd723d985233/src/Vt102Emulation.h#L189-L205)) |
| 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) |
| VTE | 0.84.1, [source](https://gitlab.gnome.org/GNOME/vte/-/tree/0.84.1) | Yes | since 0.78; ST only, and a query is answered with an empty `OSC 666 ST` ([`vtegtk.cc`](https://gitlab.gnome.org/GNOME/vte/-/blob/0.84.1/src/vtegtk.cc#L2732)) |

## Validation

### OSC666-1: Setting one changes nothing on screen

Input, one step per line:

```text
A
\e]666;vte.progress.value=50\e\\
B
```

Expected screen:

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

### OSC666-2: A query is not answered

Input, one step per line:

```text
\e]666;vte.progress.value?\e\\
```

Expected screen:

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

---

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