Ghostty terminal-ID capture almost never fires: name check requires 'claude' but Claude Code sets topic-based tab titles
#114 opened on Jul 13, 2026
Repository metrics
- Stars
- (759 stars)
- PR merge metrics
- (PR metrics pending)
Description
Summary
MaybeCaptureGhosttyTerminalID (internal/notifier/ghostty_session_darwin.go) requires the frontmost terminal's name to contain "claude":
lowerName := strings.ToLower(strings.TrimSpace(info.Name))
if !strings.Contains(lowerName, "claude") {
return false
}
In practice Claude Code sets topic-based terminal titles (e.g. ✳ Plan comprehensive 5-7 day trip to Madeira Portugal) shortly after a session starts, so the "claude" substring almost never matches. Result: terminal IDs are captured only in a brief window right after session start (while the title is still generic "Claude Code") — for long-running sessions the ID is effectively never captured, and clicks depend entirely on the cwd fallback.
This matters most in the common power-user setup where several Claude Code sessions run in tabs sharing the same project directory: without captured IDs, the cwd fallback cannot disambiguate them (see companion issue on that fallback).
Evidence (debug log, v1.40.0)
Ghostty terminal capture skipped: frontmost terminal did not match session cwd="/Users/me/Documents/BYORCA" name="✳ Plan comprehensive 5-7 day trip to Madeira Portugal" dir="/Users/me/Documents/BYORCA"
(dir matches, name check fails — capture skipped every time)
Suggestion
A much stronger capture signal exists: UserPromptSubmit. When the user submits a prompt, the frontmost Ghostty terminal is that session's tab essentially by definition (they just typed in it). Registering a UserPromptSubmit hook and capturing the frontmost terminal ID there (guarded by the existing frontmost + cwd checks, no name check needed) makes capture converge within one prompt per session. We've been running exactly this locally (a shell hook writing ghostty_terminal_id into the plugin's session state file) and exact-tab focus became reliable across ~10 concurrent same-cwd sessions.