Skip to content

Comments

Add Claude waiting detection to Window Switcher#1

Merged
chfields merged 9 commits intomainfrom
feature/claude-waiting-detection
Feb 1, 2026
Merged

Add Claude waiting detection to Window Switcher#1
chfields merged 9 commits intomainfrom
feature/claude-waiting-detection

Conversation

@chfields
Copy link
Owner

@chfields chfields commented Feb 1, 2026

Summary

  • Detect and prioritize Ghostty windows where Claude is waiting for input
  • Windows with ✳ Claude Code title sorted to top of Window Switcher
  • Match windows to workstreams by working directory (not just title)
  • Remove --title from workstream launch to allow Claude dynamic titles

Changes

  • ClaudeState enum - .waiting, .running, .working, .notRunning
  • Process tree scanning - Detect Claude processes in each window
  • Directory matching - Match windows to workstreams by shell cwd
  • Async enrichment - Window list loads instantly, enrichment happens in background
  • Fixed bugs - Pipe deadlock in process detection, lsof path (/usr/sbin not /usr/bin)

Screenshots

Window Switcher now shows:

  • Hourglass icon for windows needing input
  • Workstream names matched by directory
  • Claude state badges

Test plan

  • Launch workstream with claude command
  • Open Window Switcher (⌃⌥P)
  • Verify workstream name appears
  • Verify Claude waiting windows sorted to top
  • Test with manually opened Ghostty windows (directory matching)

🤖 Generated with Claude Code

Chris Fields and others added 9 commits February 1, 2026 04:03
- Dice button picks a random theme from filtered list
- Respects Dark/Light category filter when picking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements a new Window Switcher feature (⌃⌥P hotkey) that displays all open Ghostty windows with their actual window names for quick navigation.

Key changes:
- Add WindowSwitcherPanel and WindowSwitcherView for window management
- Implement permission checking with CGPreflightScreenCaptureAccess() before loading windows
- Add helpful UI when Screen Recording permission is not granted
- Provide "Open System Settings" and "Retry" buttons for easy permission management
- Fix race condition where loadWindows() was called before permission was ready
- Add workstream name mapping for better window identification
- Use AppleScript to focus/raise selected windows

The permission check prevents the previous issue where windows would show as "Window 1", "Window 2" instead of their actual names when permission wasn't fully initialized.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add Permissions & Privacy section explaining Screen Recording permission requirement
- Document Window Switcher feature (⌃⌥P) in Features and Usage sections
- Add ⌃⌥P to keyboard shortcuts table
- Update tips for multiple Claude sessions to highlight Window Switcher
- Clarify data collection policy: no analytics, no telemetry, all local storage

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Arrow keys (↑↓) navigate through window list with wraparound
- Enter key focuses selected window and closes panel
- Visual highlight shows selected window with accent color
- Auto-scroll keeps selected window centered in view
- Custom KeyHandlingPanel intercepts events before TextField consumes them
- WindowSwitcherViewModel manages state and keyboard event handling
- Updated footer to display keyboard shortcuts
- Added claude.md with development notes about Screen Recording permission resets

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Previously, focusing a window would activate the "main" Ghostty app,
which didn't work when each window runs as a separate process. Now:
- Track each window's PID alongside its per-process index
- Use NSRunningApplication to activate the specific process by PID
- Use Accessibility API (AXRaise) to raise the specific window
- Load windows via Accessibility API for accurate per-process indexing
- Fall back to CGWindowList if Accessibility fails
- Make process name comparison case-insensitive

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Detect and prioritize Ghostty windows where Claude is waiting for input:

- Add ClaudeState enum (.waiting, .running, .working, .notRunning)
- Detect Claude status via window title prefix (✳ = waiting, Braille = working)
- Fall back to process tree scanning when title detection unavailable
- Match windows to workstreams by PID (for app-launched windows) or
  by directory (for manually opened windows)
- Sort windows by Claude state (waiting windows appear at top)
- Remove --title from workstream launch to allow Claude dynamic titles
- Add section headers and state icons to Window Switcher UI
- Optimize process detection with single ps call and caching

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Make window enrichment async so UI doesn't block
- Fix workstream command launch by using interactive login shell (-ilc)
  to properly source .zshrc and resolve PATH for commands like 'claude'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix lsof path (/usr/sbin/lsof not /usr/bin/lsof)
- Fix pipe deadlock: read data before waitUntilExit() in getCwd()
- Add debug logging for troubleshooting process detection
- Workstream names now correctly matched by shell cwd to workstream directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the new Window Switcher capabilities:
- Claude state detection (waiting/working/running)
- Smart sorting with waiting windows at top
- Workstream matching by directory
- How Claude Code integration works

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chfields chfields merged commit 987e2f3 into main Feb 1, 2026
2 checks passed
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.

1 participant