Open a project with Cmd+O (#1849)

* feat(app): open a project with Cmd+O

Cmd+O now opens the project picker (was Cmd+Shift+O). New worktree,
which previously used Cmd+O, no longer has a keyboard shortcut; its
sidebar button still creates one.

* test(app): assert old Cmd+Shift+O open-project binding is unbound

Locks in the rebind to Cmd+O so re-adding a Cmd+Shift+O binding would fail CI.

* fix(app): keep Open project override id stable and forward Cmd+O in desktop browser

- Binding ids for Open project keep their original names so existing user
  shortcut overrides (keyed by binding id) survive the Cmd+Shift+O -> Cmd+O rebind.
- Forward "o" from focused browser webviews in the desktop app so Cmd/Ctrl+O
  reaches the renderer and opens the project picker there too.
This commit is contained in:
Mohamed Boudra
2026-07-02 02:11:11 +08:00
committed by GitHub
parent bf5e3b47e7
commit 31e9a210d0
3 changed files with 26 additions and 38 deletions
@@ -124,8 +124,8 @@ interface HelpSectionCase {
describe("keyboard-shortcuts", () => {
const matchingCases: MatchingShortcutCase[] = [
{
name: "matches Mod+Shift+O to create new agent",
event: { key: "O", code: "KeyO", metaKey: true, shiftKey: true },
name: "matches Cmd+O to open project",
event: { key: "o", code: "KeyO", metaKey: true },
context: { isMac: true },
action: "agent.new",
},
@@ -227,8 +227,8 @@ describe("keyboard-shortcuts", () => {
action: "workspace.tab.close.current",
},
{
name: "matches Ctrl+Shift+O to create new agent on non-mac",
event: { key: "O", code: "KeyO", ctrlKey: true, shiftKey: true },
name: "matches Ctrl+O to open project on non-mac",
event: { key: "o", code: "KeyO", ctrlKey: true },
context: { isMac: false },
action: "agent.new",
},
@@ -394,6 +394,16 @@ describe("keyboard-shortcuts", () => {
name: "does not keep old Alt+Shift+T binding",
event: { key: "T", code: "KeyT", altKey: true, shiftKey: true },
},
{
name: "does not keep old Cmd+Shift+O open-project binding after rebind to Cmd+O",
event: { key: "O", code: "KeyO", metaKey: true, shiftKey: true },
context: { isMac: true },
},
{
name: "does not keep old Ctrl+Shift+O open-project binding after rebind to Ctrl+O",
event: { key: "O", code: "KeyO", ctrlKey: true, shiftKey: true },
context: { isMac: false },
},
{
name: "does not match question-mark shortcut inside editable scopes",
event: { key: "?", code: "Slash", shiftKey: true },
@@ -580,7 +590,7 @@ describe("keyboard-shortcut help sections", () => {
name: "uses web defaults for workspace and tab jump",
context: { isMac: true, isDesktop: false },
expectedKeys: {
"new-agent": ["mod", "shift", "O"],
"new-agent": ["mod", "O"],
"workspace-tab-new": ["mod", "T"],
"workspace-jump-index": ["alt", "1-9"],
"workspace-tab-jump-index": ["alt", "shift", "1-9"],
@@ -594,7 +604,7 @@ describe("keyboard-shortcut help sections", () => {
name: "uses desktop defaults for workspace and tab jump",
context: { isMac: true, isDesktop: true },
expectedKeys: {
"new-agent": ["mod", "shift", "O"],
"new-agent": ["mod", "O"],
"new-workspace": ["mod", "N"],
"workspace-tab-new": ["mod", "T"],
"workspace-jump-index": ["mod", "1-9"],
@@ -121,7 +121,6 @@ const SHORTCUT_HELP_SECTION_LABEL_KEYS: Record<ShortcutSectionId, string> = {
const SHORTCUT_HELP_LABEL_KEYS: Record<string, string> = {
"new-agent": "settings.shortcuts.help.openProject",
"new-workspace": "settings.shortcuts.help.newWorkspace",
"new-worktree": "settings.shortcuts.help.newWorktree",
"archive-worktree": "settings.shortcuts.help.archiveWorktree",
"workspace-tab-new": "settings.shortcuts.help.newTab",
"workspace-tab-close-current": "settings.shortcuts.help.closeCurrentTab",
@@ -166,29 +165,33 @@ const SHORTCUT_HELP_NOTE_KEYS: Record<string, string> = {
// --- Binding definitions ---
const SHORTCUT_BINDINGS: readonly ShortcutBinding[] = [
// --- New agent ---
// --- Open project ---
// Open project moved from Cmd+Shift+O to Cmd+O. The binding ids intentionally
// keep their original "cmd-shift-o" / "ctrl-shift-o" names: user shortcut
// overrides are keyed by binding id, so renaming them would silently drop a
// user's customized Open project shortcut on upgrade.
{
id: "agent-new-cmd-shift-o-mac",
action: "agent.new",
combo: "Cmd+Shift+O",
combo: "Cmd+O",
when: { mac: true },
help: {
id: "new-agent",
section: "projects",
label: "Open project",
keys: ["mod", "shift", "O"],
keys: ["mod", "O"],
},
},
{
id: "agent-new-ctrl-shift-o-non-mac",
action: "agent.new",
combo: "Ctrl+Shift+O",
combo: "Ctrl+O",
when: { mac: false, terminal: false },
help: {
id: "new-agent",
section: "projects",
label: "Open project",
keys: ["mod", "shift", "O"],
keys: ["mod", "O"],
},
},
@@ -218,32 +221,6 @@ const SHORTCUT_BINDINGS: readonly ShortcutBinding[] = [
},
},
// --- New worktree ---
{
id: "worktree-new-cmd-o-mac",
action: "worktree.new",
combo: "Cmd+O",
when: { mac: true, commandCenter: false },
help: {
id: "new-worktree",
section: "projects",
label: "New worktree",
keys: ["mod", "O"],
},
},
{
id: "worktree-new-ctrl-o-non-mac",
action: "worktree.new",
combo: "Ctrl+O",
when: { mac: false, commandCenter: false, terminal: false },
help: {
id: "new-worktree",
section: "projects",
label: "New worktree",
keys: ["mod", "O"],
},
},
// --- Archive worktree ---
{
id: "worktree-archive-cmd-shift-backspace-mac",
+1
View File
@@ -90,6 +90,7 @@ const FORWARDED_PASEO_SHORTCUT_KEYS = new Set([
"w",
"t",
"k",
"o",
"/",
"\\",
",",