# Query Allowed Features (OSC 60)

> Ask xterm which of its optional, security-sensitive features are allowed, or, in Contour, read and change the fonts.

- **Sequence:** `OSC 60 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)
- **xterm:** [Operating System Commands](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)

Several of xterm's features are switched on or off by resources, because
they could be abused by anything written to the terminal: colors, fonts,
the mouse, pasting controls, termcap queries, titles, and window
operations. Each has an `allow…` resource, and a `disallowed…` list of the
parts of it refused while the `allow…` resource is off. XTQALLOWED,
`OSC 60 ST`, asks which `allow…` resources are on, and is answered
`OSC 60 ; list ST` with their names separated by commas
([`report_allowed_ops`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L3939-L3963)).
It takes no `;` and nothing after it; with something there, it is ignored.
[OSC 61](https://control-codes.page/osc/disallowed/index.html.md) asks which parts of a feature are refused, and
[OSC 62](https://control-codes.page/osc/allowable/index.html.md) which parts it has.

In a default xterm, `allowColorOps`, `allowFontOps`, `allowMouseOps`,
`allowTcapOps` and `allowTitleOps` are on, and `allowPasteControls` and
`allowWindowOps` off. The cases follow it.

**Contour's font settings.** Contour uses `OSC 60` for something else: its
[Query or Change Font Settings](https://github.com/contour-terminal/contour/blob/b7caade0047e76ee65548010053f5a95f84f4794/docs/vt-extensions/font-settings.md),
read at commit `b7caade`, which it puts forward as a better
[`OSC 50`](https://control-codes.page/osc/font/index.html.md). `OSC 60 ST` asks for the fonts, the same bytes as
xterm's query, and

```
OSC 60 ; size ; regular ; bold ; italic ; bold italic ST
```

changes them. The specification gives no more than those two lines. In
Contour itself, at release 0.8.0, the answer has a sixth field, the emoji
font, and the size is in hundredths of a point, so `1200` is 12 points
([`setAllFont`](https://github.com/contour-terminal/contour/blob/v0.8.0.9335/src/vtbackend/screen/Screen.cpp#L4329-L4373)).
Each font is a font description, such as `Fira Code`. When changing them, an
empty field, or a size of `0`, leaves that setting as it was, and `auto` for
a styled face or the emoji font takes it from the regular font. A change is
not made until the user allows it: Contour's `change_font` permission is
`ask` by default, and can be set to `allow` or `deny`
([`TerminalSession::setFontDef`](https://github.com/contour-terminal/contour/blob/v0.8.0.9335/src/contour/session/TerminalSession.cpp#L1042-L1093)).
A program sending `OSC 60 ST` cannot tell from the request which of the two
it will get back; the answer's second field, a number in Contour's and a
resource name in xterm's, tells them apart. xterm ignores the longer form,
as it does any `OSC 60` with something after it.

This is xterm's own, and libghostty-vt does not have it, so the case that
asks is a known difference. libghostty-vt ignores Contour's form too: fonts
are its host's business.

## 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) | Yes |  |
| libghostty-vt | [919dca5](https://github.com/ghostty-org/ghostty/tree/919dca5c848d43a489a4cb2e1feade016f0fa2db) | No | OSC60-1: not implemented |
| Konsole | 26.11.70, [a24c3d71](https://invent.kde.org/utilities/konsole/-/tree/a24c3d71be3684f24d030aa2dbe9bd723d985233) | No |  |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in ConEmu's list, [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |

## Validation

### OSC60-1: Which features are allowed

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

Input, one step per line:

```text
\e]60\a
```

Expected screen:

```text
|______|
reply \e]60;allowColorOps,allowFontOps,allowMouseOps,allowTcapOps,allowTitleOps\a
```

### OSC60-2: Contour's font settings are ignored

Input, one step per line:

```text
A
\e]60;1200;Fira Code\a
B
```

Expected screen:

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

---

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