Skip to content

feat: Cmd+1–9 worktree switching with hint overlay#394

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/cmd-n-move-worktree
Apr 9, 2026
Merged

feat: Cmd+1–9 worktree switching with hint overlay#394
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/cmd-n-move-worktree

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cmd+1–9 instant switch: Press Cmd/Ctrl + a digit key to jump directly to the Nth visible worktree in the sidebar. Works from any focus context (terminal, editor, sidebar search).
  • Cmd-hold hint overlay: Hold the platform modifier key for 0.75 seconds to reveal number badges (1–9) on worktree cards, showing which number maps to which worktree.
  • Shared visibility utility: Extracted computeVisibleWorktreeIds() so the App-level shortcut handler and WorktreeList render pipeline always agree on worktree order — including when grouping is active.

Key implementation details

  • Shortcut numbering derives from the post-buildRows() grouped order, so badges match visual card positions even with repo/PR-status grouping enabled.
  • Module-level cache (setVisibleWorktreeIds / getVisibleWorktreeIds) keeps the App-level keydown handler in sync with the rendered sidebar order.
  • useModifierHint hook handles edge cases: repeated keydown, window blur (Cmd+Tab), other-key cancellation, and cross-modifier exclusion (Ctrl+Cmd won't trigger hints).
  • Shortcut is disabled in settings view (activeView !== 'settings').

Test plan

  • Cmd+1 through Cmd+9 switches to the correct worktree
  • Shortcut works from terminal, editor, and sidebar search input
  • Hold Cmd for 1 second → number badges appear on first 9 cards
  • Release Cmd → badges disappear instantly
  • Press Cmd+N (new worktree) while holding Cmd → badges do NOT appear
  • With grouping enabled (repo or PR status), badge numbers match visual card positions
  • Cmd+digit beyond visible worktree count is a no-op (no error)
  • Shortcut is disabled in settings view
  • Ctrl+Cmd combo on Mac does not trigger hint overlay

🤖 Generated with Claude Code

brennanb2025 and others added 5 commits April 8, 2026 13:42
…difier guard

Cmd+1–9 shortcut numbering and hint badges now derive from the
post-buildRows() order so they match visual card positions when
grouping is active. Also excludes cross-modifier combos (e.g.
Ctrl+Cmd on Mac) from triggering the hint overlay.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
@brennanb2025
brennanb2025 merged commit a8e6b31 into main Apr 9, 2026
1 check passed
@brennanb2025
brennanb2025 deleted the brennanb2025/cmd-n-move-worktree branch April 9, 2026 01:12
thomaszdxsn pushed a commit to thomaszdxsn/orca that referenced this pull request Jun 15, 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.

1 participant