Skip to content

feat: add Cmd+O shortcut to open worktree in editor#1119

Merged
arnestrickmann merged 5 commits intogeneralaction:mainfrom
lukecparr:claude/cmd-o-open-editor
Feb 27, 2026
Merged

feat: add Cmd+O shortcut to open worktree in editor#1119
arnestrickmann merged 5 commits intogeneralaction:mainfrom
lukecparr:claude/cmd-o-open-editor

Conversation

@lukecparr
Copy link
Contributor

Summary

  • Add global Cmd+O keyboard shortcut to open the current worktree in the default editor (e.g., Cursor)
  • Replace native title tooltips with instant Radix tooltip showing app name and binding
  • Fix Cursor's open command to use . with cwd to avoid path-splitting on spaces
  • Only active agent's OpenInMenu responds to shortcut in multi-agent tasks

Test plan

  • Press Cmd+O to open worktree in default editor
  • Hover over Open button to see instant tooltip with app name and ⌘O
  • Verify tooltip shows immediately without delay
  • Test with multi-agent tasks to ensure only active agent opens

🤖 Generated with Claude Code

lukecparr and others added 2 commits February 25, 2026 15:03
Adds a global keyboard shortcut (Cmd+O) that opens the current task's
worktree directory in the user's default editor (e.g., Cursor). The
shortcut triggers the same action as clicking the "Open" button in the
toolbar, with a tooltip showing the binding. For multi-agent tasks,
only the active agent's OpenInMenu responds to the shortcut. Also fixes
Cursor's open command to use `.` with cwd instead of {{path}} to avoid
path-splitting issues with spaces in directory names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace native title tooltip (500ms delay) with Radix Tooltip component
using instant visibility (0ms delay). Shows dynamic label like "Open in
Cursor ⌘O" instead of generic text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 25, 2026

@lukecparr is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@lukecparr lukecparr marked this pull request as draft February 25, 2026 20:09
@greptile-apps
Copy link

greptile-apps bot commented Feb 25, 2026

Greptile Summary

This PR adds a global Cmd+O keyboard shortcut to open the current worktree in the default editor. Key changes include:

  • Implemented custom event-based communication (emdash:open-in-editor) between keyboard handler and OpenInMenu components
  • Added isActive prop to OpenInMenu to ensure only the active agent responds in multi-agent tasks (correctly coordinated via currentPath={null} in App.tsx during multi-agent mode)
  • Replaced native tooltips with instant Radix tooltips showing editor name and ⌘O binding
  • Fixed Cursor's macOS open command to use . with cwd instead of {{path}} to handle paths with spaces

The implementation is well-designed with proper event listener cleanup, correct React dependency arrays, and thoughtful handling of the single-task vs multi-agent rendering scenarios.

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • Clean implementation of a straightforward feature with proper event handling, memory leak prevention via cleanup functions, correct React patterns (useCallback with proper dependencies), and thoughtful coordination between components. The multi-agent edge case is handled correctly via conditional rendering in the parent component. No logical errors, security issues, or code quality concerns identified.
  • No files require special attention

Important Files Changed

Filename Overview
src/renderer/App.tsx Added handleOpenInEditor callback that dispatches custom event, wired to keyboard shortcuts
src/renderer/components/titlebar/OpenInMenu.tsx Added keyboard shortcut listener, Radix tooltip with instant display, and isActive prop for multi-agent coordination
src/renderer/hooks/useKeyboardShortcuts.ts Added OPEN_IN_EDITOR shortcut definition (Cmd+O) with proper handler integration
src/shared/openInApps.ts Changed Cursor's macOS command from cursor {{path}} to cursor . to avoid path-splitting on spaces

Last reviewed commit: dc303b7

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +183 to +185
<TooltipContent side="bottom" className="text-xs font-medium">
Open in {buttonAppLabel || 'editor'} ⌘O
</TooltipContent>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded ⌘O ignores non-Mac platforms

The tooltip text hardcodes ⌘O which is macOS-specific. On Windows/Linux, the shortcut resolves to Ctrl+O (since the matchesModifier function in useKeyboardShortcuts.ts maps 'cmd' to Ctrl on non-Mac platforms), but the tooltip still shows ⌘O.

This is consistent with other hardcoded symbols in the codebase (e.g., GithubDeviceFlowModal.tsx, EditorMode.tsx), so it may be an accepted pattern — but worth noting as a potential UX gap if cross-platform polish is a goal.

'command -v cursor >/dev/null 2>&1 && cursor {{path}}',
'open -a "Cursor" {{path}}',
],
openCommands: ['command -v cursor >/dev/null 2>&1 && cursor .', 'open -a "Cursor" .'],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS-only change leaves win32/linux inconsistent

The Cursor open commands were changed from cursor {{path}} to cursor . only on macOS (to avoid path-splitting on spaces). The same spaces-in-paths issue could affect win32 and linux, which still use cursor {{path}}.

On macOS this works because exec sets cwd: target (in appIpc.ts:410), so . resolves correctly. The win32/linux commands also get the same cwd, so they could potentially benefit from the same . approach — but {{path}} is shell-quoted via quoted(), so it should handle spaces correctly too. Just noting the inconsistency.

@lukecparr lukecparr closed this Feb 25, 2026
@lukecparr
Copy link
Contributor Author

Meant to open against my fork, apologies for the noise.

lukecparr and others added 2 commits February 25, 2026 15:24
Remove Linux-specific native deps step since this fork targets macOS only.
Format-check job stays on ubuntu-latest as it's platform-agnostic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The macOS runner ships Python 3.14 which removed the `distutils` module.
node-gyp needs it to build native modules (node-pty). Pin Python 3.12
and install setuptools to provide the distutils compatibility shim.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rabanspiegel
Copy link
Contributor

No this is great. We should add cmd + shift + o or cmd + o for opening in default editor @arnestrickmann

@arnestrickmann
Copy link
Contributor

Yeah, already texted you on Linkedin @lukecparr after I saw the draft pr.

this makes a lot of sense.
Would be great if you re open it!

@rabanspiegel
Copy link
Contributor

@lukecparr if you reopen, consider whether it aligns with #1008 . We will overhaul shortcuts generally to align more with conventions 🙏

@lukecparr lukecparr reopened this Feb 26, 2026
@lukecparr lukecparr marked this pull request as ready for review February 26, 2026 17:55
@lukecparr
Copy link
Contributor Author

Reopened. Let me know if I should address either of the Greptile comments.

This would be related in concept to #1008, but does not overlap since the issue doesn't cover shortcuts for opening in the IDE.

@lukecparr lukecparr marked this pull request as draft February 26, 2026 17:58
@lukecparr lukecparr marked this pull request as ready for review February 26, 2026 18:01
@lukecparr lukecparr closed this Feb 26, 2026
@lukecparr lukecparr deleted the claude/cmd-o-open-editor branch February 26, 2026 19:56
@lukecparr lukecparr restored the claude/cmd-o-open-editor branch February 26, 2026 20:52
@lukecparr lukecparr reopened this Feb 26, 2026
@arnestrickmann arnestrickmann merged commit 462fbf5 into generalaction:main Feb 27, 2026
5 of 6 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.

3 participants