From bbbe378467fa3df91d8b5fcfd2f45c0d8ee2951e Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Sat, 28 Mar 2026 13:55:06 -0700 Subject: [PATCH] feat: display hot key mappings in settings (#173) --- .../src/components/settings/Settings.tsx | 28 +++++- .../src/components/settings/ShortcutsPane.tsx | 97 +++++++++++++++++++ 2 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 src/renderer/src/components/settings/ShortcutsPane.tsx diff --git a/src/renderer/src/components/settings/Settings.tsx b/src/renderer/src/components/settings/Settings.tsx index d969ef5f6..70a9bc3fc 100644 --- a/src/renderer/src/components/settings/Settings.tsx +++ b/src/renderer/src/components/settings/Settings.tsx @@ -3,11 +3,12 @@ import type { OrcaHooks } from '../../../../shared/types' import { useAppStore } from '../../store' import { ScrollArea } from '../ui/scroll-area' import { Button } from '../ui/button' -import { ArrowLeft, Palette, SlidersHorizontal, SquareTerminal } from 'lucide-react' +import { ArrowLeft, Palette, SlidersHorizontal, SquareTerminal, Keyboard } from 'lucide-react' import { getSystemPrefersDark } from '@/lib/terminal-theme' import { SCROLLBACK_PRESETS_MB, getFallbackTerminalFonts } from './SettingsConstants' import { GeneralPane } from './GeneralPane' import { AppearancePane } from './AppearancePane' +import { ShortcutsPane } from './ShortcutsPane' import { TerminalPane } from './TerminalPane' import { RepositoryPane } from './RepositoryPane' @@ -20,9 +21,9 @@ function Settings(): React.JSX.Element { const updateRepo = useAppStore((s) => s.updateRepo) const removeRepo = useAppStore((s) => s.removeRepo) - const [selectedPane, setSelectedPane] = useState<'general' | 'appearance' | 'terminal' | 'repo'>( - 'general' - ) + const [selectedPane, setSelectedPane] = useState< + 'general' | 'appearance' | 'terminal' | 'shortcuts' | 'repo' + >('general') const [selectedRepoId, setSelectedRepoId] = useState(null) const [repoHooksMap, setRepoHooksMap] = useState< Record @@ -151,6 +152,7 @@ function Settings(): React.JSX.Element { const showGeneralPane = selectedPane === 'general' const showAppearancePane = selectedPane === 'appearance' const showTerminalPane = selectedPane === 'terminal' + const showShortcutsPane = selectedPane === 'shortcuts' const showRepoPane = selectedPane === 'repo' && !!selectedRepo const displayedGitUsername = (selectedRepo ?? repos[0])?.gitUsername ?? '' @@ -180,6 +182,11 @@ function Settings(): React.JSX.Element { Terminal appearance, previews, and defaults for new panes.

+ ) : showShortcutsPane ? ( +
+

Shortcuts

+

Keyboard shortcuts for common actions.

+
) : selectedRepo ? (
@@ -249,6 +256,17 @@ function Settings(): React.JSX.Element { Terminal +
@@ -315,6 +333,8 @@ function Settings(): React.JSX.Element { scrollbackMode={scrollbackMode} setScrollbackMode={setScrollbackMode} /> + ) : showShortcutsPane ? ( + ) : selectedRepo ? ( ( + () => [ + { + title: 'Global', + items: [ + { action: 'Create worktree', keys: [mod, 'N'] }, + { action: 'Toggle File Explorer', keys: [mod, shift, 'E'] }, + { action: 'Toggle Search', keys: [mod, shift, 'F'] }, + { action: 'Toggle Source Control', keys: [mod, shift, 'G'] } + ] + }, + { + title: 'Terminal Tabs', + items: [ + { action: 'New tab', keys: [mod, 'T'] }, + { action: 'Close active tab / pane', keys: [mod, 'W'] }, + { action: 'Next tab', keys: [mod, shift, ']'] }, + { action: 'Previous tab', keys: [mod, shift, '['] } + ] + }, + { + title: 'Terminal Panes', + items: [ + { action: 'Split pane right', keys: [mod, 'D'] }, + { action: 'Split pane down', keys: [mod, shift, 'D'] }, + { action: 'Close pane (EOF)', keys: ['Ctrl', 'D'] }, + { action: 'Focus next pane', keys: [mod, ']'] }, + { action: 'Focus previous pane', keys: [mod, '['] }, + { action: 'Clear active pane', keys: [mod, 'K'] }, + { action: 'Expand / collapse pane', keys: [mod, shift, enter] } + ] + } + ], + [mod, shift, enter] + ) + + return ( +
+
+
+

Keyboard Shortcuts

+

+ View common hotkeys used across the application. Shortcuts customization is not + currently supported. +

+
+ +
+ {groups.map((group) => ( +
+

+ {group.title} +

+
+ {group.items.map((item, idx) => ( +
+ {item.action} +
+ {item.keys.map((key, kIdx) => ( + + + {key} + + {!isMac && kIdx < item.keys.length - 1 && ( + + + )} + + ))} +
+
+ ))} +
+
+ ))} +
+
+
+ ) +}