# 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.

## 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>.
