Handle Cmd+O in handleCustomShortcut to prevent Documents folder open
Merged
AN
8mo ago+33+33+01234567890123456789-18-18-01234567890123456789
Summary
- Cmd+O for "Open Folder" was only defined in the SwiftUI menu system
- When the terminal is focused, SwiftUI's
performKeyEquivalentcan fail due to known focus bugs, causing AppKit's defaultNSDocumentControllerto handle the event and open the Documents folder - Fix: intercept Cmd+O in
handleCustomShortcut(same pattern as Cmd+N, Cmd+W, etc.) to reliably show the Open Folder panel
Fixes #2010
Test plan
- Press Cmd+O with terminal focused — should show "Open Folder" panel, not Documents
- Press Cmd+O with browser panel focused — same behavior
- Verify opening a folder works correctly after selection
🤖 Generated with Claude Code
Summary by cubic
Handle Cmd+O in handleCustomShortcut to always show the Open Folder panel, preventing NSDocumentController from opening the Documents folder when SwiftUI menu dispatch fails with terminal focus. Extracted showOpenFolderPanel() and use it from both the menu and shortcut; it seeds the panel with the current workspace’s directory via the shared main‑window resolver and opens the selection with openWorkspaceForExternalDirectory, ensuring it’s added to a workspace or a new window with that folder.
Summary by CodeRabbit
-
New Features
- Cmd+O opens a folder-selection dialog to create or add workspaces from chosen directories.
- Open-folder handling is centralized so the same dialog and workspace-opening flow is used app-wide.
-
Bug Fixes
- Cmd+O now reliably consumes the shortcut to prevent unintended default system behavior.