# Set Window Title, the dtterm Way (OSC l)

> Set the window title, as Sun's terminals and dtterm did.

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

`OSC l Pt ST` sets the window title to `Pt`, as [OSC 2](https://control-codes.page/osc/title/index.html.md) does.

Sun's terminals and CDE's dtterm set the title and the icon with a letter
instead of a number, and xterm accepts their forms too: its
[Control Sequences](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)
document lists them in its table of the Sun and dtterm window operations.
There is no `;`: everything after the letter is the text, a `;` included
([`do_osc`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L4013-L4034)).

It is also the form xterm answers in when it reports the title, `CSI 21 t`
(see [XTWINOPS](https://control-codes.page/csi/xtwinops/index.html.md)), though a default xterm refuses that
report. Unlike OSC 2, an empty `OSC l ST` sets an empty title: the `xterm`
put in place of an empty one is only for the numbered forms.

libghostty-vt has only the numbered forms and ignores the letters, so the
cases that set the title are known differences.

## Validation

### OSC-l-1: The dtterm form

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

Input, one step per line:

```text
\e]lHello\e\\
```

Expected screen:

```text
|___|
title "Hello"
```

### OSC-l-2: Everything after the l is the title

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

Input, one step per line:

```text
\e]l;two;parts\a
```

Expected screen:

```text
|___|
title ";two;parts"
```

---

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