Skip to content

Commit e019f5e

Browse files
authored
πŸ€– feat: add Cmd+, / Ctrl+, keybinding to open settings (#761)
_Generated with `mux`_ Adds keyboard shortcut to open the settings modal: - macOS: ⌘, - Windows/Linux: Ctrl+, Also updates the settings button tooltip to show the shortcut. Signed-off-by: Thomas Kosiewski <[email protected]>
1 parent d4c0c36 commit e019f5e

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)