# Request Resource Values (XTGETXRES)

> Ask xterm for the value of one of its X resources.

- **Sequence:** `DCS + Q Pt ST`
- **xterm:** [Device-Control functions](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)

`DCS + Q Pt ST` asks for the values of xterm's X resources, its settings,
by name: `Pt` is the names in hexadecimal, separated by `;`, like
[XTGETTCAP](https://control-codes.page/dcs/xtgettcap/index.html.md)'s. The answer is `DCS 1 + R name=value ST`,
with the value in hexadecimal as well, and the pairs for several names
separated by `;`. A name it does not have is written back with no value, and
whether the answer starts `1` or `0` depends only on the first name
([`XTGETXRES`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L5251-L5306),
[`vt100ResourceToString`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L10381-L10425)).
Booleans come back as `true` or `false`, numbers in decimal, and strings as
they are; a string resource that is not set has no value to give.

A program can use it to find out, for instance, whether xterm will let it
manipulate the window before trying (`allowWindowOps`). xterm always allows
it. The cases ask for resources whose values in a default xterm come from
its defaults: `allowWindowOps` is `false`, `saveLines` is `1024`, and
`decTerminalID` is `420`.

The names are X resource names, so no other terminal has the same set, and
libghostty-vt does not implement it: it consumes the string and does not
answer. The cases are known differences.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | No | not in the manual |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | No | not in the manual |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | Yes |  |
| libghostty-vt | [0f171f6](https://github.com/ghostty-org/ghostty/tree/0f171f650a1cbbd6df4a2573b6b0c7de57cc6d90) | No | consumed without an answer (XTGETXRES-1 to XTGETXRES-3) |
| kitty | 0.49.1, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/kitty.json) | No | fails the case that shows it working |
| foot | 1.28.0, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/foot.json) | No | fails the case that shows it working |
| pyte | 0.8.2, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/pyte.json) | No | fails the case that shows it working |
| xterm.js headless | 6.0.0, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/xtermjs.json) | No | fails the case that shows it working |
| alacritty_terminal | 0.26.0, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/alacritty.json) | No | fails the case that shows it working |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in ConEmu's list, which has no DCS; [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |
| rxvt-unicode | 9.31, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/urxvt.json) | No | fails the case that shows it working |
| VTE | 0.84.1, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/vte.json) | No | fails the case that shows it working |

## Validation

### XTGETXRES-1: A boolean

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

Input, one step per line:

```text
\eP+Q616C6C6F7757696E646F774F7073\e\\  # allowWindowOps
```

Expected screen:

```text
|______|
reply \eP1+R616C6C6F7757696E646F774F7073=66616C7365\e\\
```

### XTGETXRES-2: Two at once

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

Input, one step per line:

```text
\eP+Q736176654C696E6573;6465635465726D696E616C4944\e\\  # saveLines;decTerminalID
```

Expected screen:

```text
|______|
reply \eP1+R736176654C696E6573=31303234;6465635465726D696E616C4944=343230\e\\
```

### XTGETXRES-3: A name it does not have

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

Input, one step per line:

```text
\eP+Q6E6F537563684E616D65\e\\  # noSuchName
```

Expected screen:

```text
|______|
reply \eP0+R6E6F537563684E616D65\e\\
```

### XTGETXRES-4: Nothing on screen

Input, one step per line:

```text
A
\eP+Q736176654C696E6573\e\\
B
```

Expected screen:

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

---

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