Make Open With palette commands bindable - #4112
austinywang wants to merge 15 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds bindable "Open Current Directory in " palette commands: parses palette IDs, adds KeyboardShortcutSettings actions, routes shortcut events in AppDelegate, implements a launcher to resolve and open the focused directory, updates ContentView, adds tests, web/schema entries, and Xcode project wiring. ChangesTerminal Directory Open Keyboard Shortcuts
Sequence DiagramsequenceDiagram
participant User
participant AppDelegate
participant KeyboardShortcutSettings
participant TerminalDirectoryOpenLauncher
participant TabManager
participant NSWorkspace
User->>AppDelegate: Press keyboard shortcut
AppDelegate->>KeyboardShortcutSettings: Identify matching terminalDirectoryOpenAction
AppDelegate->>TerminalDirectoryOpenLauncher: openCurrentDirectory(in: tabManager)
TerminalDirectoryOpenLauncher->>TabManager: Get focused panel/workspace directory
TabManager-->>TerminalDirectoryOpenLauncher: Directory path
TerminalDirectoryOpenLauncher->>NSWorkspace: Open with chosen app / Finder select
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 15 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (15 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/App/TerminalDirectoryOpenSupport.swift`:
- Around line 330-333: The .finder branch in TerminalDirectoryOpenSupport.swift
is ignoring NSWorkspace.shared.selectFile's Bool result and always returns true;
change the .finder case (inside the function handling directory opening, e.g.,
the switch in TerminalDirectoryOpenSupport) to capture the Bool returned by
NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: directoryURL.path)
and return that result (or map it to the function's expected Bool/Result)
instead of unconditionally returning true so failures propagate to callers for
fallback/error handling.
- Around line 307-312: The loop currently uses
FileManager.default.fileExists(atPath:) which returns true for files and
directories; update the check to use the fileExists(atPath:isDirectory:)
overload and verify the isDirectory flag before returning the URL: call
FileManager.default.fileExists(atPath: trimmed, isDirectory: &isDir) (using an
ObjCBool local like isDir) and guard that isDir.boolValue is true (otherwise
continue) before creating and returning URL(fileURLWithPath: trimmed,
isDirectory: true) for focusedPanelDirectory and workspace.currentDirectory.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4a3b92ed-c20e-49a8-8d07-8edf3e29d657
📒 Files selected for processing (8)
Sources/App/TerminalDirectoryOpenSupport.swiftSources/AppDelegate.swiftSources/ContentView+RightSidebarCommandPalette.swiftSources/ContentView.swiftSources/KeyboardShortcutSettings.swiftcmuxTests/CommandPaletteShortcutCustomizationTests.swiftweb/data/cmux-shortcuts.tsweb/data/cmux.schema.json
Greptile SummaryThis PR makes every
Confidence Score: 5/5Safe to merge. The change is additive — new actions are unbound by default and only activate when a user configures a binding. All 15 new shortcut actions are off by default so there is no risk of unintentional keyboard interference for existing users. The centralized launcher correctly handles directory resolution, Finder, inline VS Code, and async application launch failures. The exhaustive switch in the action↔target mapping means the compiler will catch any future mismatch. i18n is complete: the openWith category title is translated in all 21 locale files and shortcut action labels reuse the already-localized commandPaletteTitle. The previous review thread issues are fixed on-branch. Tests cover the key behavioral paths. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant AppDelegate
participant TDOL as TerminalDirectoryOpenLauncher
participant Workspace as NSWorkspace
participant ContentView
User->>AppDelegate: Key event
AppDelegate->>AppDelegate: handleTerminalDirectoryOpenShortcut(event:)
alt chord prefix
AppDelegate->>AppDelegate: armConfiguredShortcutChordIfNeeded → return true
else full shortcut match
AppDelegate->>TDOL: openCurrentDirectory(in: target, tabManager:, onOpenFailure:)
TDOL->>TDOL: currentDirectoryURL(in: tabManager)
alt focused panel dir valid
TDOL-->>TDOL: use panelDirectories[focusedPanelId]
else fallback
TDOL-->>TDOL: use workspace.currentDirectory
end
alt "target == .finder"
TDOL->>Workspace: selectFile(nil, inFileViewerRootedAtPath:)
else "target == .vscodeInline"
TDOL->>AppDelegate: openDirectoryInInlineVSCode
else other app
TDOL->>Workspace: open(urls:withApplicationAt:configuration:completionHandler:)
Workspace-->>TDOL: completion(error) [async]
TDOL->>AppDelegate: "onOpenFailure(error) via Task @MainActor"
end
alt "result == false"
AppDelegate->>User: NSSound.beep()
end
end
User->>ContentView: Command palette
ContentView->>TDOL: openCurrentDirectory(in: target, tabManager:, onOpenFailure:)
Note over ContentView,TDOL: Same launcher path as shortcut
Reviews (11): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
Stale CodeRabbit changes-requested review. Both actionable findings from this review were addressed in later commits and the current CodeRabbit check is passing.
…pen-with-shortcuts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/App/TerminalDirectoryOpenLauncher.swift`:
- Around line 9-16: The current logic assigns rawDirectory =
focusedPanelDirectory ?? workspace.currentDirectory before validation, which
means a stale focusedPanelDirectory can cause early return and never try
workspace.currentDirectory; update TerminalDirectoryOpenLauncher.swift so you
first attempt to validate focusedPanelDirectory (check non-empty after trimming
and FileManager.default.fileExists(atPath:isDirectory:) with ObjCBool), and if
that fails fall back to validating workspace.currentDirectory the same way,
returning nil only if both candidates are empty/invalid; keep using the same
symbols (focusedPanelDirectory, workspace.currentDirectory, rawDirectory,
isDirectory) to locate and refactor the checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2d217533-218f-4b5f-b9c7-93f588cf7588
📒 Files selected for processing (13)
Sources/App/KeyboardShortcutSettings+TerminalDirectoryOpen.swiftSources/App/TerminalDirectoryOpenLauncher.swiftSources/App/TerminalDirectoryOpenSupport.swiftSources/AppDelegate.swiftSources/ContentView+RightSidebarCommandPalette.swiftSources/ContentView.swiftSources/KeyboardShortcutSettings.swiftcmux.xcodeproj/project.pbxprojcmuxTests/CommandPaletteShortcutCustomizationTests.swiftweb/data/cmux-shortcuts.tsweb/data/cmux.schema.jsonweb/messages/en.jsonweb/messages/ja.json
There was a problem hiding this comment.
2 issues found across 13 files
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Re-trigger cubic
…-4111-bindable-open-with-shortcuts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…pen-with-shortcuts
Superseded by follow-up fixes; current code validates focused and workspace directories in order, and CodeRabbit later approved the PR.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fd5125c. Configure here.
…pen-with-shortcuts
…-4111-bindable-open-with-shortcuts
…pen-with-shortcuts

Summary
palette.terminalOpenDirectory.*Open With command.Fixes #4111
Testing
git diff --checkpython3 -m json.tool web/data/cmux.schema.json >/tmp/cmux-schema-issue-4111.jsonNote
Medium Risk
Adds new user-configurable shortcut actions and event routing to launch external apps for the current directory; incorrect mapping or directory resolution could make shortcuts fail or open the wrong location, but changes are localized and guarded with beeps/fallbacks and tests.
Overview
Makes the command palette’s Open With (
palette.terminalOpenDirectory.*) commands first-class, bindableKeyboardShortcutSettings.Actions (all unbound by default), including labels and settings-file parsing support.Centralizes “open current directory” behavior in
TerminalDirectoryOpenLauncherand routes these new shortcut actions throughAppDelegate(including chord-prefix arming), whileContentViewnow delegates its focused-directory opener to the same launcher.Updates the web shortcut registry/schema and i18n category label, and adds unit tests covering action exposure,
cmux.jsonbinding parsing, directory fallback selection, and launch failure reporting.Reviewed by Cursor Bugbot for commit 73a764b. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Makes all “Open With” palette commands bindable to keyboard shortcuts and routes them through a single in‑process launcher for consistent behavior from both the palette and shortcuts. Satisfies #4111; you can bind actions like
palette.terminalOpenDirectory.vscodeincmux.json.New Features
palette.terminalOpenDirectory.*(all unbound; configurable incmux.jsonand shown under the new “Open With” category).TerminalDirectoryOpenLauncherfor centralized directory resolution (focused panel, then workspace) and app launching; used by the palette andAppDelegate; supports chorded bindings, Finder reveal, Inline VS Code, and beeps on failure.ContentView.commandPaletteShortcutActionandTerminalDirectoryOpenTarget(commandPaletteCommandId:); updatedweb/data/cmux.schema.json,web/data/cmux-shortcuts.ts, and localized the “Open With” category.Bug Fixes
Written for commit 73a764b. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
New Features
Settings
UI Integration
Tests
Localization