# Set Icon, the dtterm Way (OSC I)

> Set the window's icon from a file, as dtterm did.

- **Sequence:** `OSC I 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 I Pt ST` sets the window's icon, the picture a window manager shows
for it, from the file `Pt`.

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

xterm loads the icon from an XPM file, if it was built with the Xpm library:
it searches for `Pt`, adding `.xpm` if need be, and `none` asks for no icon
at all ([`xtermLoadIcon`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L6010-L6110)). Nothing on the screen
changes.

libghostty-vt has no icon and ignores `OSC I`, which a case cannot tell
apart from xterm.

## Validation

### OSC-I-1: Nothing on screen, and the title is left alone

Input, one step per line:

```text
\e]2;Window\a
\e]Inone\a
A
```

Expected screen:

```text
|A__|
title "Window"
cursor 1,2
```

---

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