Skip to content

Fix ⌘⌫ archive hotkey when clicking a sidebar worktree#264

Merged
sbertix merged 1 commit intomainfrom
sbertix/fix-archive-hotkey
Apr 21, 2026
Merged

Fix ⌘⌫ archive hotkey when clicking a sidebar worktree#264
sbertix merged 1 commit intomainfrom
sbertix/fix-archive-hotkey

Conversation

@sbertix
Copy link
Copy Markdown
Collaborator

@sbertix sbertix commented Apr 21, 2026

Summary

  • GhosttySurfaceView.performKeyEquivalent relied on a cached focused flag that stayed true when a sidebar List row was clicked — AppKit walks performKeyEquivalent over every view in the window, so the surface was swallowing ⌘⌫ even though the selection had moved to the sidebar.
  • Added a strict window?.firstResponder === self check alongside focused so the surface only processes events AppKit actually routes to it. ⌘⌫ now falls through to the main-menu Archive item instead of being consumed by the terminal.

Test plan

  • make check && make test — all 939 tests pass
  • Click a non-main worktree in the sidebar, press ⌘⌫ → archive confirmation appears
  • Focus the terminal, press ⌘⌫ → still gets consumed by Ghostty (kill-line) as before
  • Reveal in Sidebar + ⌘⌫ path still works

The cached `focused` flag is updated via `becomeFirstResponder` /
`resignFirstResponder`, but AppKit walks `performKeyEquivalent` over
every view in the window. Clicking a sidebar `List` row takes
selection without always demoting the surface out of the responder
chain, so ⌘⌫ reached `keyDown` and was consumed by the terminal
instead of firing Archive Worktree in the main menu. Check
`window?.firstResponder === self` alongside `focused` so the surface
only processes events AppKit actually routes to it.
@sbertix sbertix enabled auto-merge (squash) April 21, 2026 13:33
@tuist
Copy link
Copy Markdown

tuist Bot commented Apr 21, 2026

🛠️ Tuist Run Report 🛠️

Builds 🔨

Scheme Status Duration Commit
supacode 1m 16s 102bc850c

@sbertix sbertix merged commit 539c0fe into main Apr 21, 2026
2 checks passed
@sbertix sbertix deleted the sbertix/fix-archive-hotkey branch April 21, 2026 13:39
jzillmann referenced this pull request in jzillmann/supacool Apr 23, 2026
The cached `focused` flag is updated via `becomeFirstResponder` /
`resignFirstResponder`, but AppKit walks `performKeyEquivalent` over
every view in the window. Clicking a sidebar `List` row takes
selection without always demoting the surface out of the responder
chain, so ⌘⌫ reached `keyDown` and was consumed by the terminal
instead of firing Archive Worktree in the main menu. Check
`window?.firstResponder === self` alongside `focused` so the surface
only processes events AppKit actually routes to it.
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