diff --git a/frontend/src/components/session/SessionPickerDialog.test.tsx b/frontend/src/components/session/SessionPickerDialog.test.tsx index 6a8fdc3a..4aecddc2 100644 --- a/frontend/src/components/session/SessionPickerDialog.test.tsx +++ b/frontend/src/components/session/SessionPickerDialog.test.tsx @@ -578,6 +578,17 @@ describe('SessionPickerDialog', () => { expect(screen.getByText(/Ctrl\+G sessions/)).toBeInTheDocument() }) + it('shows the normalized leader, arrow and key in the footer for a leader switch binding', () => { + mocks.preferences = { + keyboardShortcuts: { switchPickerTab: 'G' }, + directShortcuts: [], + leaderKey: 'Ctrl+X', + } + renderPicker() + + expect(screen.getByText(/Ctrl\+X → G projects/)).toBeInTheDocument() + }) + it('no longer switches tabs on Ctrl+O', () => { renderPicker() diff --git a/frontend/src/components/session/SessionPickerDialog.tsx b/frontend/src/components/session/SessionPickerDialog.tsx index 2a248e06..b3c03bda 100644 --- a/frontend/src/components/session/SessionPickerDialog.tsx +++ b/frontend/src/components/session/SessionPickerDialog.tsx @@ -28,7 +28,7 @@ import { useSessionStatusForSession } from '@/stores/sessionStatusStore' import { useShortcutActions } from '@/contexts/KeyboardShortcutsContext' import { useSettings } from '@/hooks/useSettings' import { buildPinnedSessionKeys, getSessionKey } from '@/lib/sessionKey' -import { normalizeShortcut, resolveShortcutBindings, type ShortcutBindings } from '@/lib/keyboardShortcuts' +import { formatShortcutLabel, resolveShortcutBindings } from '@/lib/keyboardShortcuts' import { cn, formatShortRelativeTime, getRepoDisplayName } from '@/lib/utils' import { FINE_POINTER_MEDIA_QUERY, useMediaQuery } from '@/hooks/useMediaQuery' @@ -39,14 +39,6 @@ const NEAR_BOTTOM_PX = 240 type SessionPickerTab = 'sessions' | 'projects' -function switchTabShortcutLabel(bindings: ShortcutBindings): string { - const keys = bindings.shortcuts.switchPickerTab - if (!keys) return '' - const normalized = normalizeShortcut(keys) - if (bindings.directShortcuts.includes('switchPickerTab')) return normalized - return `${bindings.leaderKey} ${normalized}` -} - interface SessionPickerDialogProps { open: boolean onOpenChange: (open: boolean) => void @@ -716,7 +708,14 @@ export function SessionPickerDialog({ const hasFinePointer = useMediaQuery(FINE_POINTER_MEDIA_QUERY) const { preferences } = useSettings() const switchHint = useMemo( - () => switchTabShortcutLabel(resolveShortcutBindings(preferences)), + () => { + const bindings = resolveShortcutBindings(preferences) + return formatShortcutLabel( + bindings.shortcuts.switchPickerTab, + bindings.directShortcuts.includes('switchPickerTab'), + bindings.leaderKey, + ) + }, [preferences], ) const [tab, setTab] = useState('sessions') diff --git a/frontend/src/components/settings/KeyboardShortcuts.tsx b/frontend/src/components/settings/KeyboardShortcuts.tsx index 42f911a1..c6e151df 100644 --- a/frontend/src/components/settings/KeyboardShortcuts.tsx +++ b/frontend/src/components/settings/KeyboardShortcuts.tsx @@ -3,14 +3,14 @@ import { useSettings } from '@/hooks/useSettings' import { useMobile } from '@/hooks/useMobile' import { Loader2, X } from 'lucide-react' import { Button } from '@/components/ui/button' -import { formatEventModifiers, formatShortcutEvent, isModifierOnlyEvent, normalizeShortcut, resolveShortcutBindings } from '@/lib/keyboardShortcuts' +import { formatEventModifiers, formatShortcutEvent, formatShortcutLabel, isModifierOnlyEvent, normalizeShortcut, resolveShortcutBindings } from '@/lib/keyboardShortcuts' import { applyTuiKeybindImport, parseTuiKeybindConfig } from '@/lib/tuiKeybindImport' import { showToast } from '@/lib/toast' const CONVERSATION_ACTIONS = ['submit', 'abort', 'clearPrompt', 'toggleMode', 'undo', 'redo', 'compact', 'fork', 'timeline', 'exportSession', 'selectModel', 'variantCycle', 'favoriteCycle', 'halfPageUp', 'halfPageDown'] const NAVIGATION_ACTIONS = ['settings', 'sessions', 'switchPickerTab', 'newSession', 'closeSession', 'toggleSidebar', 'toggleTerminal', 'toggleSourceControl'] -const formatShortcutLabel = (action: string): string => { +const formatActionLabel = (action: string): string => { return action.replace(/([A-Z])/g, ' $1').trim() } @@ -87,7 +87,7 @@ function ShortcutRow({ action, keys, isDirect, display, isRecording, currentKeys return (
-

{formatShortcutLabel(action)}

+

{formatActionLabel(action)}