Skip to main content

Module chrome

Module chrome 

Source
Expand description

Everything the terminal shows that is not a cell of the frame.

Five decorations, one rule. The rule first, because it is the whole design: every one of these degrades to nothing. Nothing here probes a capability, waits for an answer, or sniffs a version beyond reading two environment variables; a terminal that does not know a sequence ignores it, and a terminal this cannot identify is simply told less. None of it runs at all when stdout is not a terminal, because an escape sequence written into a pipe is corruption of somebody’s data.

§What each one buys

  • Synchronized output (DEC 2026) wraps every frame. Without it a 10 fps repaint tears, and it tears worst over ssh, which is where a sweep of a disk that is filling up tends to run. This is the one decoration with no allowlist: the private mode is defined to be ignorable and every terminal that parses CSI already drops what it does not know.

  • OSC 9;4 progress puts a real bar on the dock or the taskbar. A full price of one real ~/repos is 55.8 s, which is long enough that the reader has gone somewhere else, and the percentage is one the pool already knows: claims priced over claims found.

  • OSC 0 title makes a backgrounded run readable from the tab bar. It is restored on the way out, including the error path — see Chrome::restore — and it is only ever set on a terminal that can restore it. See Title.

  • One notification, and only when the run was long enough to be worth interrupting somebody for and they are demonstrably looking elsewhere. A notification for a 200 ms scan is spam.

  • The kitty graphics protocol is the one decoration that is cells rather than chrome: it is what puts super::treemap’s picture on the screen. It is decided here anyway, because what decides it is which terminal this is, which is this table’s subject — and two tables reading one environment are two tables that can disagree.

§Why four of the five are allowlisted, and one is not

Only the synchronized update goes everywhere, because it is the only one that leaves nothing behind: an unknown private mode is dropped by every parser that understands CSI, and there is no state to give back afterwards. The other four all fail by persisting — an image most loudly of all, since a terminal that does not decode APC G prints a megabyte of base64 into the reader’s scrollback.

Two of them fail by being misread, and OSC 9 colliding with itself is why. OSC 9 ; <text> is a desktop notification in iTerm2, WezTerm and Ghostty; OSC 9 ; 4 ; <state> ; <percent> is ConEmu’s progress bar, read by WezTerm, Ghostty, ConEmu and Windows Terminal. A terminal that knows only the first reads a progress report as a notification saying 4;1;41, which is worse than no bar at all.

The third fails by being unreturnable, which is subtler and worse. Setting a title is easy everywhere; putting the old one back needs a title stack that not every terminal keeps, and a terminal without one is simply left holding pristine — freed 41.2 GiB forever. So the title is not a flag — it is the push/pop pair itself (Title), present only for terminals documented to keep the stack, which makes “set a title nothing can clear” unrepresentable rather than merely avoided.

Structs§

Chrome
The terminal’s decorations, and the promise to undo them.
Decor
Which decorations a terminal is known to read.
Title
How a terminal’s window title is taken, and given back.

Enums§

Notify
The spelling of a desktop notification that a given terminal reads.
Status
What the tab bar and the taskbar say about a run, at one moment.

Constants§

XTERM_STACK
xterm’s title stack, which is the only one there is.