feat(desktop): add Cmd+Shift+P shortcut and always-visible PR button#1177
Conversation
Show PR button in changes header even when no PR exists — clicking it creates a PR. Register OPEN_PR hotkey (⌘⇧P) that opens the existing PR or creates one if none exists.
📝 WalkthroughWalkthroughThis change introduces a new "Open PR" keyboard shortcut (meta+shift+p) that enables users to open existing pull requests or create new ones from the workspace dashboard. The feature includes hotkey registration, shortcut integration with PR status checking, and UI button support for PR creation when none exists. Changes
Sequence DiagramsequenceDiagram
participant User
participant Hotkey as Hotkey System
participant PRStatus as PR Status Hook
participant Mutation as PR Mutation
participant GitHub as GitHub/External
User->>Hotkey: Press meta+shift+p
Hotkey->>PRStatus: Fetch PR status
alt PR Exists
PRStatus-->>User: Open PR URL in new tab
else No PR
PRStatus-->>Mutation: Trigger createPRMutation
Mutation->>Mutation: Prepare PR creation payload
Mutation->>GitHub: Create Pull Request
GitHub-->>Mutation: Success response
Mutation-->>User: Show "Opening GitHub..." toast
Mutation->>User: Refresh and navigate
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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: 1
🤖 Fix all issues with AI agents
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ChangesHeader/components/PRButton/PRButton.tsx`:
- Around line 58-73: PRButton renders an icon-only button when no PR exists; add
accessibility attributes so screen readers can announce it: update the button
inside PRButton (the element using createPRMutation.mutate and worktreePath) to
include a descriptive aria-label (e.g., "Create pull request") and set
aria-busy={createPRMutation.isPending} while the mutation is pending; keep the
existing disabled prop and visual loading icon behavior.
🧹 Nitpick comments (1)
apps/desktop/src/shared/hotkeys.ts (1)
649-654: Consider explicit Win/Linux defaults forOPEN_PR.
deriveNonMacDefaultwill translatemeta+shift+ptoctrl+shift+alt+pon Win/Linux. If the intended cross-platform mapping is the commonCtrl+Shift+P, set explicit defaults.♻️ Suggested defaults override
OPEN_PR: defineHotkey({ keys: "meta+shift+p", label: "Open Pull Request", category: "Workspace", description: "Open existing PR or create a new one on GitHub", + defaults: { + win32: "ctrl+shift+p", + linux: "ctrl+shift+p", + }, }),
| if (!pr) { | ||
| return ( | ||
| <Tooltip> | ||
| <TooltipTrigger asChild> | ||
| <button | ||
| type="button" | ||
| className="flex items-center ml-auto hover:opacity-80 transition-opacity disabled:opacity-50" | ||
| onClick={() => createPRMutation.mutate({ worktreePath })} | ||
| disabled={createPRMutation.isPending} | ||
| > | ||
| {createPRMutation.isPending ? ( | ||
| <LuLoaderCircle className="w-4 h-4 animate-spin text-muted-foreground" /> | ||
| ) : ( | ||
| <LuGitPullRequest className="w-4 h-4 text-muted-foreground" /> | ||
| )} | ||
| </button> |
There was a problem hiding this comment.
Add an accessible label for the icon-only PR button.
The create-PR button is icon-only, so screen readers won’t get a usable name. Add aria-label (and optionally aria-busy) to make it discoverable.
♿ Suggested accessibility fix
<button
type="button"
className="flex items-center ml-auto hover:opacity-80 transition-opacity disabled:opacity-50"
onClick={() => createPRMutation.mutate({ worktreePath })}
disabled={createPRMutation.isPending}
+ aria-label={
+ createPRMutation.isPending
+ ? "Creating pull request"
+ : "Create Pull Request"
+ }
+ aria-busy={createPRMutation.isPending}
>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (!pr) { | |
| return ( | |
| <Tooltip> | |
| <TooltipTrigger asChild> | |
| <button | |
| type="button" | |
| className="flex items-center ml-auto hover:opacity-80 transition-opacity disabled:opacity-50" | |
| onClick={() => createPRMutation.mutate({ worktreePath })} | |
| disabled={createPRMutation.isPending} | |
| > | |
| {createPRMutation.isPending ? ( | |
| <LuLoaderCircle className="w-4 h-4 animate-spin text-muted-foreground" /> | |
| ) : ( | |
| <LuGitPullRequest className="w-4 h-4 text-muted-foreground" /> | |
| )} | |
| </button> | |
| if (!pr) { | |
| return ( | |
| <Tooltip> | |
| <TooltipTrigger asChild> | |
| <button | |
| type="button" | |
| className="flex items-center ml-auto hover:opacity-80 transition-opacity disabled:opacity-50" | |
| onClick={() => createPRMutation.mutate({ worktreePath })} | |
| disabled={createPRMutation.isPending} | |
| aria-label={ | |
| createPRMutation.isPending | |
| ? "Creating pull request" | |
| : "Create Pull Request" | |
| } | |
| aria-busy={createPRMutation.isPending} | |
| > | |
| {createPRMutation.isPending ? ( | |
| <LuLoaderCircle className="w-4 h-4 animate-spin text-muted-foreground" /> | |
| ) : ( | |
| <LuGitPullRequest className="w-4 h-4 text-muted-foreground" /> | |
| )} | |
| </button> |
🤖 Prompt for AI Agents
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ChangesHeader/components/PRButton/PRButton.tsx`
around lines 58 - 73, PRButton renders an icon-only button when no PR exists;
add accessibility attributes so screen readers can announce it: update the
button inside PRButton (the element using createPRMutation.mutate and
worktreePath) to include a descriptive aria-label (e.g., "Create pull request")
and set aria-busy={createPRMutation.isPending} while the mutation is pending;
keep the existing disabled prop and visual loading icon behavior.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
|
This works for me. Keeping in mind there might be a command palette at some point which will take precedence for CMD+P. At that time I will move the default hotkeys and let you know |
Summary
OPEN_PRhotkey (Cmd+Shift+P) to the workspace hotkeys, registered in the workspace pageCmd+Shift+Popens the PR URL in the browser; when none exists, it triggers PR creationTest plan
#number,Cmd+Shift+Popens the PR in browserCmd+Shift+Pcreates the PRbun run typecheckpassesbun run lintpassesSummary by CodeRabbit
Release Notes