# Set App ID (OSC 176)

> Set the app ID that a Wayland compositor, or an X window manager, groups and decorates the terminal's window by.

- **Sequence:** `OSC 176 ; 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)
- **Specification:** [Custom App ID in terminal emulators](https://gist.github.com/delthas/d451e2cc1573bb2364839849c7117239/3650e6597ca67302fce717c775ea844c730200b5)

`OSC 176 ; Pt ST` sets the terminal window's *app ID*, the name a Wayland
compositor (or the window class an X window manager) uses to pick the
window's icon, to group it with other windows of the same app, and to pin it
to a dock. A long-running terminal program, a mail reader or a chat client,
can use it to make its window look like the program's own rather than the
terminal's. An empty `Pt` removes the app ID again, and
`OSC 176 ; ? ST` asks for it, answered with `OSC 176 ; Pt ST`. A program is
meant to ask on start, set its own, and put the old one back when it exits.

It comes from a short specification by delthas,
[Custom App ID in terminal emulators](https://gist.github.com/delthas/d451e2cc1573bb2364839849c7117239/3650e6597ca67302fce717c775ea844c730200b5),
which suggests a terminal honor it only when the program is the only thing
in the window, and keep app IDs under 255 characters. It names foot as the
terminal that implements it, from 1.17.0. foot ignores a value that is not
printable UTF-8, cuts it at 2048 characters, clears it on a full reset, and
since 1.20.2 no longer answers the query
([`foot-ctlseqs(7)`](https://codeberg.org/dnkl/foot/src/tag/1.28.0/doc/foot-ctlseqs.7.scd#L790),
[`osc.c`](https://codeberg.org/dnkl/foot/src/tag/1.28.0/osc.c#L1655)).

A default xterm has no `OSC 176` and ignores it
([the OSC numbers it knows](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L3476-L3504)).
The cases follow xterm.

libghostty-vt does not recognize `OSC 176` either: its OSC parser in
`osc.zig` has no state for the number, so the string is dropped, and the
cases pass.

## 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) | No | ignored |
| libghostty-vt | [83edd49](https://github.com/ghostty-org/ghostty/tree/83edd491e3024ae5e50393d62877b8897da1cccd) | No | ignored |
| Konsole | 26.11.70, [a24c3d71](https://invent.kde.org/utilities/konsole/-/tree/a24c3d71be3684f24d030aa2dbe9bd723d985233) | No | not among the OSC numbers it handles ([`Vt102Emulation.h`](https://invent.kde.org/utilities/konsole/-/blob/a24c3d71be3684f24d030aa2dbe9bd723d985233/src/Vt102Emulation.h#L189-L205)) |
| foot | 1.28.0 | Yes | sets the app ID, but has not answered the query since 1.20.2 ([`foot-ctlseqs(7)`](https://codeberg.org/dnkl/foot/src/tag/1.28.0/doc/foot-ctlseqs.7.scd#L790)) |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in its [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |

## Validation

### OSC176-1: Setting it changes nothing on screen

Input, one step per line:

```text
A
\e]176;org.example.mail\e\\
B
```

Expected screen:

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

### OSC176-2: A query is not answered

Input, one step per line:

```text
\e]176;?\e\\
```

Expected screen:

```text
|______|
reply none
```

---

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