Skip to content

Ghostty: no per-tab TTY/PID — missing cross-reference and TTY switch fallback #63

Closed

Description

@grimmerk

Summary

Ghostty and cmux lacks per-tab TTY/PID in their APIs, which prevents two capabilities that iTerm2 has:

  1. Detection cross-reference — for bare claude or claude -r sessions with in-session /rename, iTerm2 can match PID → TTY → tab name → custom title → session ID. Ghostty/cmux cannot do this, so the purple dot may be on the wrong session.

  2. Switch TTY fallback — for -r <uuid> sessions without /rename, iTerm2 can use TTY matching to switch to the correct tab even without a custom title. Ghostty/cmux fall back to cwd matching which may switch to the wrong tab.

What's needed

Either per-tab TTY or PID exposed via the terminal's API (AppleScript or CLI). Either one enables cross-referencing with claude process TTYs (ps -o tty=).

Upstream tracking

Terminal Item Status Impact
Ghostty Issue #11592 — Add pid/tty to AppleScript terminal class Open Would enable both cross-reference and TTY switch fallback
Ghostty PR #11354 & PR #11922— Expose PID/TTY on TerminalEntity Open Implementation in progress
cmux PR #2040(released) — Could expose per-surface TTY via CLI (list-pane-surfaces or similar)

Current workaround

Users should use claude -n "name" or /rename + exit + resume for same-cwd sessions on Ghostty/cmux. See README and design doc for the full accuracy matrix.

Related

🤖 On behalf of @grimmerk — generated with Claude Code

Activity

  1. grimmerk commented on Mar 30, 2026

    @grimmerk
    OwnerAuthor

    Update: cmux per-surface TTY is now supported via manaflow-ai/cmux#2040 (merged). CodeV cmux cross-reference detection implemented in PR #64 (merged).

    Remaining: Ghostty still lacks per-tab TTY/PID — pending upstream ghostty#11592.

    Note: With the discovery of ~/.claude/sessions/ (#65), cross-reference may become unnecessary for detection — sessions/<PID>.json provides direct PID→sessionId mapping. Cross-reference would still be needed for switch layer TTY matching on Ghostty (once TTY is available upstream).

    🤖 On behalf of @grimmerk — generated with Claude Code

  2. grimmerk commented on Mar 30, 2026

    @grimmerk
    OwnerAuthor

    Update: cmux now has three-layer switch matching (title → TTY → cwd), same as iTerm2. PR #69.

    Remaining: Ghostty still lacks per-tab TTY — pending ghostty#11354. When Ghostty adds TTY/PID support, the changes needed in CodeV are:

    1. Add TTY switch layer to openSessionInGhostty (same pattern as iTerm2/cmux — ps -o tty= → match against Ghostty tab TTYs)
    2. Ghostty cross-ref in crossRefDisambiguate already has a placeholder (byTerminal['ghostty'] → cwd fallback) — replace with TTY matching

    Both are small changes once upstream support lands.

    🤖 On behalf of @grimmerk — generated with Claude Code

  3. changed the title [-]Ghostty/cmux: no per-tab TTY/PID — missing cross-reference and TTY switch fallback[/-] [+]Ghostty: no per-tab TTY/PID — missing cross-reference and TTY switch fallback[/+] on Mar 31, 2026
  4. 00-kat commented on Apr 24, 2026

    @00-kat

    I have absolutely no clue what CodeV is, I come here from GitHub's xref in ghostty-org/ghostty#11354; FYI, selecting a TTY/PID is now supported on tip, xref ghostty-org/ghostty#10756, ghostty-org/ghostty#11592, and ghostty-org/ghostty#11922. This will make it into a release around September (unless it's backported to 1.3, which I doubt).

  5. grimmerk commented on Oct 22, 2026

    @grimmerk
    OwnerAuthor

    Update: Ghostty tip builds now expose per-terminal tty and pid (ghostty-org/ghostty#11922, merged; not yet in a release as of v1.3.1). #165 uses it for both items listed above: the switch layer (tty and title in pid-provenance order, then cwd) and Ghostty's branch of crossRefDisambiguate. Measured on tip build 18371: with 16 terminals sharing one directory, the old cwd-only switch sent every un-renamed session to the same tab; by tty each reached its own. Stable Ghostty keeps today's title → cwd behaviour, since the property is read by its raw code inside try.

    🤖 On behalf of @grimmerk — generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions