Skip to content

Commit 7ace5f7

Browse files
committed
🤖 feat: add Cmd+, / Ctrl+, keybinding to open settings
Change-Id: Ic9a116797e63defbe25b09ab269fb311b818db1d Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent d4c0c36 commit 7ace5f7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/browser/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ function AppInner() {
462462
} else if (matchesKeybind(e, KEYBINDS.TOGGLE_SIDEBAR)) {
463463
e.preventDefault();
464464
setSidebarCollapsed((prev) => !prev);
465+
} else if (matchesKeybind(e, KEYBINDS.OPEN_SETTINGS)) {
466+
e.preventDefault();
467+
openSettings();
465468
}
466469
};
467470

@@ -473,6 +476,7 @@ function AppInner() {
473476
isCommandPaletteOpen,
474477
closeCommandPalette,
475478
openCommandPalette,
479+
openSettings,
476480
]);
477481

478482
// Handle workspace fork switch event

src/browser/components/SettingsButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Settings } from "lucide-react";
22
import { useSettings } from "@/browser/contexts/SettingsContext";
33
import { TooltipWrapper, Tooltip } from "./Tooltip";
4+
import { formatKeybind, KEYBINDS } from "@/browser/utils/ui/keybinds";
45

56
export function SettingsButton() {
67
const { open } = useSettings();
@@ -16,7 +17,7 @@ export function SettingsButton() {
1617
>
1718
<Settings className="h-3.5 w-3.5" aria-hidden />
1819
</button>
19-
<Tooltip align="right">Settings</Tooltip>
20+
<Tooltip align="right">Settings ({formatKeybind(KEYBINDS.OPEN_SETTINGS)})</Tooltip>
2021
</TooltipWrapper>
2122
);
2223
}

src/browser/utils/ui/keybinds.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,8 @@ export const KEYBINDS = {
281281

282282
/** Toggle hunk expand/collapse in Code Review panel */
283283
TOGGLE_HUNK_COLLAPSE: { key: " " },
284+
285+
/** Open settings modal */
286+
// macOS: Cmd+, Win/Linux: Ctrl+,
287+
OPEN_SETTINGS: { key: ",", ctrl: true },
284288
} as const;

0 commit comments

Comments
 (0)