How pane titles flow from Claude Code to TermX — and how to make it better
The pipe connecting your shell to TermX. Each pane gets one (e.g. /dev/ttys003). Everything you see flows through it — text, colors, and control sequences.
Special bytes mixed into the terminal stream that say "this is a command, not text." Example: \e]0;Title\a sets the window title. iTerm2 added custom ones under \e]1337;….
Any way for two programs to talk. File-based IPC: one writes a file, the other reads it. Other options: sockets, pipes, or sending data through the TTY itself.
macOS APIs to watch for file changes. Instead of reading a file every 700ms to check ("polling"), the OS tells you when it changes. Efficient, but still file-based.
Minimal change — keep the file IPC but use macOS file system notifications instead of polling.
Data flows through the same channel as everything else — the terminal stream. No files, no polling.
Use iTerm2's built-in Python API — a long-running script communicates over WebSocket.
| A: FSEvents | B: OSC Sequences | C: Python API | |
|---|---|---|---|
| Transport | File + OS notification | TTY stream (already exists) | WebSocket |
| Latency | ~10-100ms | <1ms (next read cycle) | ~5-20ms |
| Stale state? | Yes — files persist | No — dies with TTY | No |
| Code change size | Small | Medium | Large |
| Extensibility | Limited (file format) | Key-value pairs in sequence | Full API |
| External deps | None | None | Python runtime |
| Arrangement restore | Read cached file | Save to session state on receive | API can re-query |
The most natural fit for a terminal emulator. Data flows through the same channel as everything else. No files to manage, no polling to tune, no daemons to run. TermX already parses OSC 1337 — we just add a new parameter.
1. TermX side — Add handler in VT100 parser for SetTermXTitle key in OSC 1337. Parse name=, color=, project=, status= params. Store in PTYSession properties. Save to session arrangement for restore.
2. Hook script — Claude Code hook that emits the OSC sequence with session name + color. Runs on session start and status changes.
3. Remove old system — Delete file polling code, cache directory references, and icon stripping logic.
4. Color upgrade — Better hash (djb2/fnv) over larger palette, or let the hook pick the color directly.