Skip to content

fix: focus Ghostty tab for tmux sessions#43

Merged
wxtsky merged 1 commit intowxtsky:mainfrom
duoduohe:fix/ghostty-tmux-tab-focus
Apr 8, 2026
Merged

fix: focus Ghostty tab for tmux sessions#43
wxtsky merged 1 commit intowxtsky:mainfrom
duoduohe:fix/ghostty-tmux-tab-focus

Conversation

@duoduohe
Copy link
Copy Markdown
Contributor

@duoduohe duoduohe commented Apr 8, 2026

Problem

When multiple Ghostty tabs are open under tmux, Ghostty often reports a generic AppleScript "working directory" (e.g. ~) for all terminals. CodeIsland's CWD-based matching can therefore fail and the Ghostty button only activates the app instead of focusing the correct tab.

Fix

  • If a tmux pane is available, derive a tmux window key via tmux display-message (e.g. #{session_name}:#{window_index}:#{window_name}) and prefer matching Ghostty terminal titles first (with a tmuxcc-style fallback: title starts with <session>:).
  • Fall back to the existing heuristics (session ID / source keyword / CWD matching).
  • Persist the raw TMUX env var from hook payload (_tmux) and pass it to tmux subprocesses, so GUI-launched CodeIsland targets the correct tmux server/socket.
  • Run the Ghostty AppleScript via /usr/bin/osascript out-of-process.

Tests

  • swift test

Ghostty often reports a generic working directory under tmux, so CWD-based matching can fail and only activate the app. When a tmux pane is available, derive the tmux session/window key and match Ghostty terminal titles first (tmuxcc-style fallback).\n\nAlso persist the raw TMUX env var from hooks and pass it to tmux subprocesses so we target the correct tmux server/socket.
@duoduohe duoduohe force-pushed the fix/ghostty-tmux-tab-focus branch from 42195ba to 0d2d8e4 Compare April 8, 2026 15:21
@wxtsky wxtsky merged commit 0a37aca into wxtsky:main Apr 8, 2026
nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Apr 9, 2026
Scouted wxtsky/CodeIsland v1.0.10–v1.0.16 and vibeislandapp/vibe-island
(April 7–9 2026). Added 5 kanban tasks for actionable v1.0.16 changes:

- T-011: Warp terminal misdetection fix (bundle ID over TERM_PROGRAM)
- T-012: Stuck session auto-reset + hook exec PID fix
- T-013: Ghostty+tmux tab focus fix (PR wxtsky#43)
- T-014: Menu bar icon when panel is auto-hidden (PR wxtsky#39)
- T-015: Clickable session card to jump to terminal (wxtsky#37)

Updated CLAUDE.md scouted-but-unsynced notes. Skipped: CI/DMG build
fixes (v1.0.10–15), notarization/signing, Copilot CLI, open PR wxtsky#42 (SSH).

https://claude.ai/code/session_01XNkMdQ4G4cwFZHX1TdNFM9
@duoduohe duoduohe deleted the fix/ghostty-tmux-tab-focus branch April 9, 2026 02:53
heiboy0070 pushed a commit to heiboy0070/CodeIsland that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants