From 9600e15757c6e6cbb640e13cb36f51d3ee7971e7 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Fri, 19 Jun 2026 16:41:05 -0700 Subject: [PATCH] fix(shortcuts): redesign keyboard shortcut settings with per-binding rows (#5850) --- ...ver-reveal-touch-action-visibility.test.ts | 3 +- .../settings/ShortcutBindingRow.tsx | 373 ------------------ .../settings/ShortcutBindingSubRow.tsx | 80 ++++ .../settings/ShortcutCommandBlock.tsx | 366 +++++++++++++++++ .../settings/ShortcutFilterRail.tsx | 2 +- .../settings/ShortcutRecorderButton.tsx | 233 +++++++++++ .../settings/ShortcutRemoveButton.tsx | 48 +++ .../components/settings/ShortcutRowsList.tsx | 44 ++- .../src/components/settings/ShortcutsPane.tsx | 188 +++++---- .../settings/keybinding-override-edits.ts | 37 ++ .../shortcut-binding-list-mutations.test.ts | 87 ++++ .../shortcut-binding-list-mutations.ts | 43 ++ .../settings/shortcut-terminal-status.ts | 67 ++++ src/renderer/src/i18n/locales/en.json | 43 +- src/renderer/src/i18n/locales/es.json | 43 +- src/renderer/src/i18n/locales/ja.json | 43 +- src/renderer/src/i18n/locales/ko.json | 43 +- src/renderer/src/i18n/locales/zh.json | 43 +- 18 files changed, 1237 insertions(+), 549 deletions(-) delete mode 100644 src/renderer/src/components/settings/ShortcutBindingRow.tsx create mode 100644 src/renderer/src/components/settings/ShortcutBindingSubRow.tsx create mode 100644 src/renderer/src/components/settings/ShortcutCommandBlock.tsx create mode 100644 src/renderer/src/components/settings/ShortcutRecorderButton.tsx create mode 100644 src/renderer/src/components/settings/ShortcutRemoveButton.tsx create mode 100644 src/renderer/src/components/settings/keybinding-override-edits.ts create mode 100644 src/renderer/src/components/settings/shortcut-binding-list-mutations.test.ts create mode 100644 src/renderer/src/components/settings/shortcut-binding-list-mutations.ts create mode 100644 src/renderer/src/components/settings/shortcut-terminal-status.ts diff --git a/src/renderer/src/components/hover-reveal-touch-action-visibility.test.ts b/src/renderer/src/components/hover-reveal-touch-action-visibility.test.ts index c8398ccf3..bccd5867f 100644 --- a/src/renderer/src/components/hover-reveal-touch-action-visibility.test.ts +++ b/src/renderer/src/components/hover-reveal-touch-action-visibility.test.ts @@ -23,7 +23,8 @@ const HOVER_REVEAL_FILES = [ resolve(__dirname, 'right-sidebar/SourceControl.tsx'), resolve(__dirname, 'right-sidebar/checks-panel-content.tsx'), resolve(__dirname, 'settings/MobilePairingQrSection.tsx'), - resolve(__dirname, 'settings/ShortcutBindingRow.tsx'), + resolve(__dirname, 'settings/ShortcutBindingSubRow.tsx'), + resolve(__dirname, 'settings/ShortcutCommandBlock.tsx'), resolve(__dirname, 'settings/VoiceSpeechModelSection.tsx'), resolve(__dirname, 'sidebar/HostSectionHeaderMenu.tsx'), resolve(__dirname, 'sidebar/PendingWorktreeRow.tsx'), diff --git a/src/renderer/src/components/settings/ShortcutBindingRow.tsx b/src/renderer/src/components/settings/ShortcutBindingRow.tsx deleted file mode 100644 index 9e40dbb9d..000000000 --- a/src/renderer/src/components/settings/ShortcutBindingRow.tsx +++ /dev/null @@ -1,373 +0,0 @@ -import React, { useEffect, useRef } from 'react' -import { Ban, Plus, RotateCcw, Terminal } from 'lucide-react' -import { - formatKeybinding, - isDigitIndexActionId, - isDoubleTapBinding, - type KeybindingActionId, - type KeybindingDefinition, - type KeybindingInput -} from '../../../../shared/keybindings' -import { - ModifierDoubleTapDetector, - modifierFromKeyEvent, - toModifierDoubleTapEvent -} from '../../../../shared/modifier-double-tap-detector' -import { cn } from '../../lib/utils' -import { ShortcutKeyCombo } from '../ShortcutKeyCombo' -import { Badge } from '../ui/badge' -import { Button } from '../ui/button' -import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip' -import { SearchableSetting } from './SearchableSetting' -import { translate } from '@/i18n/i18n' - -type ShortcutBindingRowProps = { - item: KeybindingDefinition - groupTitle: string - platform: NodeJS.Platform - effective: readonly string[] - modified: boolean - error?: string - warnings: readonly string[] - recording: boolean - terminalStatus?: ShortcutTerminalStatus - onStartRecording: (actionId: KeybindingActionId) => void - onCancelRecording: () => void - onCapture: (actionId: KeybindingActionId, input: KeybindingInput) => void - onClearError: (actionId: KeybindingActionId) => void - onDisable: (actionId: KeybindingActionId) => void - onReset: (actionId: KeybindingActionId) => void -} - -export type ShortcutTerminalStatus = { - label: string - description: string -} - -// Why: digit-index rows store one representative chord (e.g. ⌘1) but fire for -// 1-9, so the trailing number cap renders the whole range. -function toDigitRangeKeys(keys: string[]): string[] { - const last = keys.at(-1) - if (last === undefined || !/^[1-9]$/.test(last)) { - return keys - } - return [...keys.slice(0, -1), `${last}–9`] -} - -export function ShortcutBindingRow({ - item, - groupTitle, - platform, - effective, - modified, - error, - warnings, - recording, - terminalStatus, - onStartRecording, - onCancelRecording, - onCapture, - onClearError, - onDisable, - onReset -}: ShortcutBindingRowProps): React.JSX.Element { - const recordButtonRef = useRef(null) - const doubleTapDetectorRef = useRef(null) - if (!doubleTapDetectorRef.current) { - doubleTapDetectorRef.current = new ModifierDoubleTapDetector() - } - - useEffect(() => { - if (recording) { - recordButtonRef.current?.focus() - } else { - // Stale taps mustn't survive into the next recording session. - doubleTapDetectorRef.current?.reset() - } - window.api.ui.setShortcutRecorderFocused(recording) - return () => window.api.ui.setShortcutRecorderFocused(false) - }, [recording]) - - const statusMessage = error ?? (warnings.length > 0 ? warnings.join(' ') : '') - const doubleTapHint = platform === 'darwin' ? '⇧⇧' : 'Shift Shift' - const recordingMessage = recording - ? translate( - 'auto.components.settings.ShortcutBindingRow.a98d551407', - 'Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.', - { value0: doubleTapHint } - ) - : '' - const helperMessage = statusMessage || recordingMessage - const hasBinding = effective.length > 0 - - const handleRecordKeyDown = (event: React.KeyboardEvent): void => { - if (!recording) { - if (event.key === 'Enter' || event.key === ' ') { - event.preventDefault() - onStartRecording(item.id) - } - return - } - - event.preventDefault() - event.stopPropagation() - - if (event.key === 'Escape') { - doubleTapDetectorRef.current?.reset() - onClearError(item.id) - onCancelRecording() - return - } - - // A modifier press never captures on its own — the detector decides whether - // it completes a double-tap, leaving normal chords to capture on their key. - if (modifierFromKeyEvent(event.code, event.key) !== null) { - const detected = doubleTapDetectorRef.current?.process( - toModifierDoubleTapEvent({ - type: 'keyDown', - code: event.code, - key: event.key, - shift: event.shiftKey, - control: event.ctrlKey, - alt: event.altKey, - meta: event.metaKey, - isAutoRepeat: event.repeat - }), - Date.now() - ) - if (detected) { - onClearError(item.id) - onCapture(item.id, { doubleTapModifier: detected.modifier }) - doubleTapDetectorRef.current?.reset() - } - return - } - - doubleTapDetectorRef.current?.reset() - onClearError(item.id) - onCapture(item.id, { - key: event.key, - code: event.code, - alt: event.altKey, - meta: event.metaKey, - control: event.ctrlKey, - shift: event.shiftKey - }) - } - - const handleRecordKeyUp = (event: React.KeyboardEvent): void => { - if (!recording) { - return - } - event.preventDefault() - event.stopPropagation() - doubleTapDetectorRef.current?.process( - toModifierDoubleTapEvent({ - type: 'keyUp', - code: event.code, - key: event.key, - shift: event.shiftKey, - control: event.ctrlKey, - alt: event.altKey, - meta: event.metaKey - }), - Date.now() - ) - } - - // Why: the recorder is the row's primary control — clicking the keys (or the - // "Add shortcut" placeholder) records a new binding in place, so the whole - // affordance lives inline rather than in a detached popover. - const recorderLabel = recording - ? `Press shortcut keys for ${item.title}. Escape cancels.` - : hasBinding - ? `Change shortcut for ${item.title}` - : `Add shortcut for ${item.title}` - - const isDigitIndex = isDigitIndexActionId(item.id) - - return ( - -
-
- {item.title} - {modified ? ( - - {translate('auto.components.settings.ShortcutBindingRow.97dccee14e', 'Modified')} - - ) : null} - {terminalStatus ? ( - - - - - {terminalStatus.label} - - - - {terminalStatus.description} - - - ) : null} -
- {helperMessage ? ( - - {helperMessage} - - ) : null} -
- -
- {/* Reset/Disable reveal on hover or keyboard focus to keep the row calm; - they stay reachable via focus-within for keyboard users. */} - {hasBinding ? ( -
- {modified ? ( - - - - - - {translate( - 'auto.components.settings.ShortcutBindingRow.f75335b155', - 'Reset to default' - )} - - - ) : null} - - - - - - {translate( - 'auto.components.settings.ShortcutBindingRow.9cdaaa3d8f', - 'Disable shortcut' - )} - - -
- ) : null} - - - - - - - {recording - ? translate( - 'auto.components.settings.ShortcutBindingRow.6a7848fdac', - 'Listening for shortcut' - ) - : hasBinding - ? translate( - 'auto.components.settings.ShortcutBindingRow.f6579be67b', - 'Change shortcut' - ) - : translate( - 'auto.components.settings.ShortcutBindingRow.4a4c2c9d32', - 'Add shortcut' - )} - - -
-
- ) -} diff --git a/src/renderer/src/components/settings/ShortcutBindingSubRow.tsx b/src/renderer/src/components/settings/ShortcutBindingSubRow.tsx new file mode 100644 index 000000000..bfc4b9c88 --- /dev/null +++ b/src/renderer/src/components/settings/ShortcutBindingSubRow.tsx @@ -0,0 +1,80 @@ +import React from 'react' +import type { KeybindingActionId, KeybindingInput } from '../../../../shared/keybindings' +import { ShortcutRecorderButton } from './ShortcutRecorderButton' +import { ShortcutRemoveButton } from './ShortcutRemoveButton' + +type ShortcutBindingSubRowProps = { + actionId: KeybindingActionId + title: string + platform: NodeJS.Platform + isDigitIndex: boolean + // The chord this row edits, or null for the transient "add a new binding" slot. + binding: string | null + bindingIndex: number + bindingCount: number + recording: boolean + isAppendSlot?: boolean + onStartRecording: (actionId: KeybindingActionId, index: number) => void + onCancelRecording: () => void + onCapture: (actionId: KeybindingActionId, input: KeybindingInput) => void + onClearError: (actionId: KeybindingActionId) => void + onRemove: (actionId: KeybindingActionId, index: number) => void +} + +// A second-or-later binding of an action. The chord sits at the right edge (so +// chips line up with the binding on the command row); the remove control reveals +// on hover. +export function ShortcutBindingSubRow({ + actionId, + title, + platform, + isDigitIndex, + binding, + bindingIndex, + bindingCount, + recording, + isAppendSlot = false, + onStartRecording, + onCancelRecording, + onCapture, + onClearError, + onRemove +}: ShortcutBindingSubRowProps): React.JSX.Element { + return ( +
+
+ {/* Remove reveals on hover/focus to keep the row calm; keyboard users + reach it via focus-within. The append slot reserves the column with an + invisible spacer so the recorder stays aligned across rows. */} + {isAppendSlot ? ( +
+ ) +} diff --git a/src/renderer/src/components/settings/ShortcutCommandBlock.tsx b/src/renderer/src/components/settings/ShortcutCommandBlock.tsx new file mode 100644 index 000000000..853e6ae3c --- /dev/null +++ b/src/renderer/src/components/settings/ShortcutCommandBlock.tsx @@ -0,0 +1,366 @@ +import React from 'react' +import { Ban, Plus, RotateCcw, Terminal } from 'lucide-react' +import { + isDigitIndexActionId, + type KeybindingActionId, + type KeybindingDefinition, + type KeybindingInput +} from '../../../../shared/keybindings' +import { cn } from '../../lib/utils' +import { Badge } from '../ui/badge' +import { Button } from '../ui/button' +import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip' +import { SearchableSetting } from './SearchableSetting' +import { ShortcutBindingSubRow } from './ShortcutBindingSubRow' +import { ShortcutRecorderButton } from './ShortcutRecorderButton' +import { ShortcutRemoveButton } from './ShortcutRemoveButton' +import type { ShortcutTerminalStatus } from './shortcut-terminal-status' +import { translate } from '@/i18n/i18n' + +type ShortcutCommandBlockProps = { + item: KeybindingDefinition + groupTitle: string + platform: NodeJS.Platform + effective: readonly string[] + modified: boolean + error?: string + warnings: readonly string[] + terminalStatus?: ShortcutTerminalStatus + // The bindings this action had right before it was disabled, so it can be + // re-enabled with one click. Empty when there's nothing to restore. + previousBindings: readonly string[] + // Non-null only when this action is recording; the binding index being + // recorded. Equal to effective.length when capturing a brand-new binding. + recordingBindingIndex: number | null + onStartRecordingAt: (actionId: KeybindingActionId, index: number) => void + onAppendBinding: (actionId: KeybindingActionId) => void + onCancelRecording: () => void + onCapture: (actionId: KeybindingActionId, input: KeybindingInput) => void + onClearError: (actionId: KeybindingActionId) => void + onRemoveBindingAt: (actionId: KeybindingActionId, index: number) => void + onResetAction: (actionId: KeybindingActionId) => void + onDisableAction: (actionId: KeybindingActionId) => void + onEnableAction: (actionId: KeybindingActionId) => void +} + +export function ShortcutCommandBlock({ + item, + groupTitle, + platform, + effective, + modified, + error, + warnings, + terminalStatus, + previousBindings, + recordingBindingIndex, + onStartRecordingAt, + onAppendBinding, + onCancelRecording, + onCapture, + onClearError, + onRemoveBindingAt, + onResetAction, + onDisableAction, + onEnableAction +}: ShortcutCommandBlockProps): React.JSX.Element { + const hasBinding = effective.length > 0 + const isMulti = effective.length >= 2 + // An explicit empty override means the user turned the action off entirely. + const isDisabled = modified && !hasBinding + const isRecording = recordingBindingIndex !== null + const showAppendSlot = recordingBindingIndex !== null && recordingBindingIndex >= effective.length + const isDigitIndex = isDigitIndexActionId(item.id) + const canEnable = isDisabled && previousBindings.length > 0 + + const doubleTapHint = platform === 'darwin' ? '⇧⇧' : 'Shift Shift' + const recordingMessage = translate( + 'auto.components.settings.ShortcutCommandBlock.eb72c52c28', + 'Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.', + { value0: doubleTapHint } + ) + // Errors win, then the live recording hint, then a standing conflict warning. + const helperMessage = error + ? error + : isRecording + ? recordingMessage + : warnings.length > 0 + ? warnings.join(' ') + : '' + const helperTone = error || (!isRecording && warnings.length > 0) ? 'error' : 'muted' + + const recorderFor = (binding: string | null, index: number): React.JSX.Element => ( + + ) + + return ( + +
+
+ + {item.title} + + {modified ? ( + + {translate('auto.components.settings.ShortcutCommandBlock.287e07ddde', 'Modified')} + + ) : null} + {isDisabled ? ( + + {translate('auto.components.settings.ShortcutCommandBlock.3c83cd7d1c', 'Disabled')} + + ) : null} + {terminalStatus && hasBinding ? ( + + + + + {terminalStatus.label} + + + + {terminalStatus.description} + + + ) : null} +
+ +
+ {/* Action controls reveal on hover/focus to keep the list calm. Reset + is gated on `modified` (not on having a binding) so it's reachable + even when the action is disabled. */} +
+ {hasBinding && !showAppendSlot ? ( + + + + + + {translate( + 'auto.components.settings.ShortcutCommandBlock.245c83af24', + 'Add another shortcut' + )} + + + ) : null} + {modified ? ( + + + + + + {translate( + 'auto.components.settings.ShortcutCommandBlock.9b02917027', + 'Reset to default' + )} + + + ) : null} + {hasBinding ? ( + + + + + + {translate( + 'auto.components.settings.ShortcutCommandBlock.25e6e76618', + 'Disable shortcut' + )} + + + ) : null} + {/* Remove just the first binding (only meaningful when others + remain; a single binding is turned off with Disable instead). */} + {isMulti ? ( + + ) : null} +
+ + {/* No binding: the primary affordance stays visible (the row would + otherwise read as empty). Enable restores the pre-disable chord; + otherwise Add records a fresh one. */} + {!hasBinding && !showAppendSlot ? ( + canEnable ? ( + + ) : ( + + + + + + {translate( + 'auto.components.settings.ShortcutCommandBlock.035a822ef0', + 'Add shortcut' + )} + + + ) + ) : null} + + {/* The first binding lives inline on the command row; extras stack + below. A single-binding action is therefore one line. */} + {hasBinding ? recorderFor(effective[0], 0) : null} +
+
+ + {helperMessage ? ( + + {helperMessage} + + ) : null} + + {/* Bindings beyond the first stack as their own rows under the command. */} + {isMulti + ? effective.slice(1).map((binding, offset) => { + const index = offset + 1 + return ( + + ) + }) + : null} + + {showAppendSlot ? ( + + ) : null} +
+ ) +} diff --git a/src/renderer/src/components/settings/ShortcutFilterRail.tsx b/src/renderer/src/components/settings/ShortcutFilterRail.tsx index 97a86badc..37440a5a2 100644 --- a/src/renderer/src/components/settings/ShortcutFilterRail.tsx +++ b/src/renderer/src/components/settings/ShortcutFilterRail.tsx @@ -4,7 +4,7 @@ import { formatKeybindingList, type KeybindingDefinition } from '../../../../sha import { cn } from '../../lib/utils' import { Button } from '../ui/button' import { Input } from '../ui/input' -import type { ShortcutTerminalStatus } from './ShortcutBindingRow' +import type { ShortcutTerminalStatus } from './shortcut-terminal-status' import type { SettingsSearchEntry } from './settings-search' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/settings/ShortcutRecorderButton.tsx b/src/renderer/src/components/settings/ShortcutRecorderButton.tsx new file mode 100644 index 000000000..1961fbf50 --- /dev/null +++ b/src/renderer/src/components/settings/ShortcutRecorderButton.tsx @@ -0,0 +1,233 @@ +import React, { useEffect, useRef } from 'react' +import { + formatKeybinding, + isDoubleTapBinding, + type KeybindingActionId, + type KeybindingInput +} from '../../../../shared/keybindings' +import { + ModifierDoubleTapDetector, + modifierFromKeyEvent, + toModifierDoubleTapEvent +} from '../../../../shared/modifier-double-tap-detector' +import { cn } from '../../lib/utils' +import { ShortcutKeyCombo } from '../ShortcutKeyCombo' +import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip' +import { translate } from '@/i18n/i18n' + +type ShortcutRecorderButtonProps = { + actionId: KeybindingActionId + title: string + platform: NodeJS.Platform + isDigitIndex: boolean + // The chord this button edits, or null for the transient "add a new binding" slot. + binding: string | null + bindingIndex: number + bindingCount: number + recording: boolean + isAppendSlot?: boolean + onStartRecording: (actionId: KeybindingActionId, index: number) => void + onCancelRecording: () => void + onCapture: (actionId: KeybindingActionId, input: KeybindingInput) => void + onClearError: (actionId: KeybindingActionId) => void +} + +// Why: digit-index rows store one representative chord (e.g. ⌘1) but fire for +// 1-9, so the trailing number cap renders the whole range. +function toDigitRangeKeys(keys: string[]): string[] { + const last = keys.at(-1) + if (last === undefined || !/^[1-9]$/.test(last)) { + return keys + } + return [...keys.slice(0, -1), `${last}–9`] +} + +export function ShortcutRecorderButton({ + actionId, + title, + platform, + isDigitIndex, + binding, + bindingIndex, + bindingCount, + recording, + isAppendSlot = false, + onStartRecording, + onCancelRecording, + onCapture, + onClearError +}: ShortcutRecorderButtonProps): React.JSX.Element { + const recordButtonRef = useRef(null) + const doubleTapDetectorRef = useRef(null) + if (!doubleTapDetectorRef.current) { + doubleTapDetectorRef.current = new ModifierDoubleTapDetector() + } + + useEffect(() => { + if (recording) { + recordButtonRef.current?.focus() + } else { + // Stale taps mustn't survive into the next recording session. + doubleTapDetectorRef.current?.reset() + } + // The global recorder-focused flag is owned by ShortcutsPane (one source of + // truth across rows), so it isn't toggled here. + }, [recording]) + + const handleRecordKeyDown = (event: React.KeyboardEvent): void => { + if (!recording) { + if (event.key === 'Enter' || event.key === ' ') { + event.preventDefault() + onStartRecording(actionId, bindingIndex) + } + return + } + + event.preventDefault() + event.stopPropagation() + + if (event.key === 'Escape') { + doubleTapDetectorRef.current?.reset() + onClearError(actionId) + onCancelRecording() + return + } + + // A modifier press never captures on its own — the detector decides whether + // it completes a double-tap, leaving normal chords to capture on their key. + if (modifierFromKeyEvent(event.code, event.key) !== null) { + const detected = doubleTapDetectorRef.current?.process( + toModifierDoubleTapEvent({ + type: 'keyDown', + code: event.code, + key: event.key, + shift: event.shiftKey, + control: event.ctrlKey, + alt: event.altKey, + meta: event.metaKey, + isAutoRepeat: event.repeat + }), + Date.now() + ) + if (detected) { + onClearError(actionId) + onCapture(actionId, { doubleTapModifier: detected.modifier }) + doubleTapDetectorRef.current?.reset() + } + return + } + + doubleTapDetectorRef.current?.reset() + onClearError(actionId) + onCapture(actionId, { + key: event.key, + code: event.code, + alt: event.altKey, + meta: event.metaKey, + control: event.ctrlKey, + shift: event.shiftKey + }) + } + + const handleRecordKeyUp = (event: React.KeyboardEvent): void => { + if (!recording) { + return + } + event.preventDefault() + event.stopPropagation() + doubleTapDetectorRef.current?.process( + toModifierDoubleTapEvent({ + type: 'keyUp', + code: event.code, + key: event.key, + shift: event.shiftKey, + control: event.ctrlKey, + alt: event.altKey, + meta: event.metaKey + }), + Date.now() + ) + } + + const recorderLabel = recording + ? translate( + 'auto.components.settings.ShortcutRecorderButton.1a13bb054d', + 'Press shortcut keys for {{value0}}. Escape cancels.', + { value0: title } + ) + : isAppendSlot || binding === null + ? translate( + 'auto.components.settings.ShortcutRecorderButton.3732775d74', + 'Add shortcut for {{value0}}', + { value0: title } + ) + : bindingCount <= 1 + ? translate( + 'auto.components.settings.ShortcutRecorderButton.88764af2c1', + 'Change shortcut for {{value0}}', + { value0: title } + ) + : translate( + 'auto.components.settings.ShortcutRecorderButton.30feb099d6', + 'Change shortcut {{value0}} of {{value1}} for {{value2}}', + { value0: String(bindingIndex + 1), value1: String(bindingCount), value2: title } + ) + + const tooltipLabel = recording + ? translate( + 'auto.components.settings.ShortcutRecorderButton.5d982a2a1f', + 'Listening for shortcut' + ) + : isAppendSlot || binding === null + ? translate('auto.components.settings.ShortcutRecorderButton.152e0bcd64', 'Add shortcut') + : translate('auto.components.settings.ShortcutRecorderButton.5bd56445da', 'Change shortcut') + + const keys = binding === null ? [] : formatKeybinding(binding, platform) + + return ( + + + + + + {tooltipLabel} + + + ) +} diff --git a/src/renderer/src/components/settings/ShortcutRemoveButton.tsx b/src/renderer/src/components/settings/ShortcutRemoveButton.tsx new file mode 100644 index 000000000..e669c74ad --- /dev/null +++ b/src/renderer/src/components/settings/ShortcutRemoveButton.tsx @@ -0,0 +1,48 @@ +import React from 'react' +import { X } from 'lucide-react' +import type { KeybindingActionId } from '../../../../shared/keybindings' +import { Button } from '../ui/button' +import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip' +import { translate } from '@/i18n/i18n' + +// Removes one binding from an action. The hover-reveal wrapper lives in the +// parent row so it can key off that row's hover group (the header row and the +// sub-rows use different group names). +export function ShortcutRemoveButton({ + actionId, + title, + bindingIndex, + onRemove +}: { + actionId: KeybindingActionId + title: string + bindingIndex: number + onRemove: (actionId: KeybindingActionId, index: number) => void +}): React.JSX.Element { + return ( + + + + + + {translate( + 'auto.components.settings.ShortcutRemoveButton.2a9588b1c2', + 'Remove this binding' + )} + + + ) +} diff --git a/src/renderer/src/components/settings/ShortcutRowsList.tsx b/src/renderer/src/components/settings/ShortcutRowsList.tsx index 18df3554c..3d12ddeb6 100644 --- a/src/renderer/src/components/settings/ShortcutRowsList.tsx +++ b/src/renderer/src/components/settings/ShortcutRowsList.tsx @@ -1,34 +1,46 @@ import React from 'react' import type { KeybindingActionId, KeybindingInput } from '../../../../shared/keybindings' import { cn } from '../../lib/utils' -import { ShortcutBindingRow } from './ShortcutBindingRow' +import { ShortcutCommandBlock } from './ShortcutCommandBlock' import type { ShortcutRowsByGroup } from './ShortcutFilterRail' import { translate } from '@/i18n/i18n' +const EMPTY_BINDINGS: readonly string[] = [] + export function ShortcutRowsList({ className, groups, platform, errors, + disableMemory, recordingActionId, - onStartRecording, + recordingBindingIndex, + onStartRecordingAt, + onAppendBinding, onCancelRecording, onCapture, onClearError, - onDisable, - onReset + onRemoveBindingAt, + onResetAction, + onDisableAction, + onEnableAction }: { className?: string groups: ShortcutRowsByGroup[] platform: NodeJS.Platform errors: Partial> + disableMemory: Partial> recordingActionId: KeybindingActionId | null - onStartRecording: (actionId: KeybindingActionId) => void + recordingBindingIndex: number | null + onStartRecordingAt: (actionId: KeybindingActionId, index: number) => void + onAppendBinding: (actionId: KeybindingActionId) => void onCancelRecording: () => void onCapture: (actionId: KeybindingActionId, input: KeybindingInput) => void onClearError: (actionId: KeybindingActionId) => void - onDisable: (actionId: KeybindingActionId) => void - onReset: (actionId: KeybindingActionId) => void + onRemoveBindingAt: (actionId: KeybindingActionId, index: number) => void + onResetAction: (actionId: KeybindingActionId) => void + onDisableAction: (actionId: KeybindingActionId) => void + onEnableAction: (actionId: KeybindingActionId) => void }): React.JSX.Element { if (groups.length === 0) { return ( @@ -53,9 +65,9 @@ export function ShortcutRowsList({

{group.title}

-
+
{group.rows.map((row) => ( - ))}
diff --git a/src/renderer/src/components/settings/ShortcutsPane.tsx b/src/renderer/src/components/settings/ShortcutsPane.tsx index 5d8876dd0..d2cecce56 100644 --- a/src/renderer/src/components/settings/ShortcutsPane.tsx +++ b/src/renderer/src/components/settings/ShortcutsPane.tsx @@ -1,19 +1,13 @@ -import React, { useMemo, useState } from 'react' +import React, { useEffect, useMemo, useState } from 'react' import { findKeybindingConflicts, formatKeybindingList, getEffectiveKeybindingsForAction, getKeybindingDefinition, - isKeybindingAllowedInTerminal, - isKeybindingPotentialTerminalConflict, keybindingFromInputForAction, - keybindingIsActiveInContext, normalizeKeybindingListForAction, type KeybindingActionId, - type KeybindingDefinition, - type KeybindingInput, - type KeybindingOverrides, - type TerminalShortcutPolicy + type KeybindingInput } from '../../../../shared/keybindings' import { EMPTY_DISABLED_TUI_AGENTS, @@ -23,7 +17,13 @@ import { import { useAppStore } from '../../store' import { KeybindingsFileActions } from './KeybindingsFileActions' import { SettingsSubsectionHeader } from './SettingsFormControls' -import type { ShortcutTerminalStatus } from './ShortcutBindingRow' +import { getShortcutTerminalStatus } from './shortcut-terminal-status' +import { + hasCommonBindingOverride, + hasOwnBindingOverride, + removeBindingOverride, + sameBindings +} from './keybinding-override-edits' import { getShortcutSearchEntry, matchesShortcutFilter, @@ -37,6 +37,12 @@ import { ShortcutTerminalPolicyControl } from './ShortcutTerminalPolicyControl' import { getTerminalShortcutPolicySearchEntry } from './shortcuts-search' import { matchesSettingsSearch, normalizeSettingsSearchQuery } from './settings-search' import { clearRecordingActionForShortcutMutation } from './shortcut-recording-state' +import { + adjustRecordingIndexAfterRemove, + appendBinding, + removeBindingAt, + replaceBindingAt +} from './shortcut-binding-list-mutations' import { useMountedRef } from '@/hooks/useMountedRef' import { translate } from '@/i18n/i18n' @@ -47,83 +53,6 @@ const platform: NodeJS.Platform = isMac ? 'win32' : 'linux' -function sameBindings(a: readonly string[], b: readonly string[]): boolean { - return a.length === b.length && a.every((binding, index) => binding === b[index]) -} - -function hasOwnBindingOverride( - overrides: KeybindingOverrides, - actionId: KeybindingActionId -): boolean { - return Object.prototype.hasOwnProperty.call(overrides, actionId) -} - -function removeBindingOverride( - overrides: KeybindingOverrides, - actionId: KeybindingActionId -): KeybindingOverrides { - const next = { ...overrides } - delete next[actionId] - return next -} - -function hasCommonBindingOverride( - snapshot: ReturnType['keybindingSnapshot'], - actionId: KeybindingActionId -): boolean { - return hasOwnBindingOverride(snapshot?.commonOverrides ?? {}, actionId) -} - -function getShortcutTerminalStatus( - definition: KeybindingDefinition, - terminalShortcutPolicy: TerminalShortcutPolicy, - hasEffectiveBinding: boolean -): ShortcutTerminalStatus | undefined { - if (!hasEffectiveBinding) { - return undefined - } - if (definition.scope === 'terminal') { - return { - label: translate('auto.components.settings.ShortcutsPane.cb02e00202', 'Terminal'), - description: translate( - 'auto.components.settings.ShortcutsPane.781cb74d22', - 'Runs from terminal panes.' - ) - } - } - if (isKeybindingAllowedInTerminal(definition)) { - return { - label: translate('auto.components.settings.ShortcutsPane.25b0004fbf', 'Terminal active'), - description: translate( - 'auto.components.settings.ShortcutsPane.3c0fac059a', - 'Still runs while a terminal has keyboard focus.' - ) - } - } - if (!isKeybindingPotentialTerminalConflict(definition)) { - return undefined - } - const activeInTerminal = keybindingIsActiveInContext(definition, { - context: 'terminal', - terminalShortcutPolicy - }) - return activeInTerminal - ? { - label: translate('auto.components.settings.ShortcutsPane.2a0e8aeccf', 'Orca first'), - description: translate( - 'auto.components.settings.ShortcutsPane.dfa8ff612f', - 'Also runs while a terminal or TUI has keyboard focus.' - ) - } - : { - label: translate('auto.components.settings.ShortcutsPane.5c65d5db9d', 'Terminal first'), - description: translate( - 'auto.components.settings.ShortcutsPane.f0b35b0b2e', - 'Disabled while a terminal or TUI has keyboard focus.' - ) - } -} - export function ShortcutsPane(): React.JSX.Element { const searchQuery = useAppStore((state) => state.settingsSearchQuery) const terminalShortcutPolicy = useAppStore( @@ -141,9 +70,25 @@ export function ShortcutsPane(): React.JSX.Element { const mountedRef = useMountedRef() const [errors, setErrors] = useState>>({}) const [recordingActionId, setRecordingActionId] = useState(null) + // Which binding index of the recording action is being captured. Equals the + // effective length when capturing a brand-new (appended) binding. + const [recordingBindingIndex, setRecordingBindingIndex] = useState(null) + // Bindings an action had right before it was disabled, so "Enable" can restore + // them in one click instead of forcing a reset-to-default. + const [disableMemory, setDisableMemory] = useState>>( + {} + ) const [shortcutQuery, setShortcutQuery] = useState('') const [shortcutFilter, setShortcutFilter] = useState('all') + // Why: tell the main process to suspend global shortcut dispatch while any row + // is recording, so the captured chord lands in the editor instead of firing. + // One source of truth here avoids races between per-row recorder effects. + useEffect(() => { + window.api.ui.setShortcutRecorderFocused(recordingActionId !== null) + return () => window.api.ui.setShortcutRecorderFocused(false) + }, [recordingActionId]) + const groups = useMemo(() => groupDefinitions(disabledTuiAgents), [disabledTuiAgents]) const ignoredConflictActionIds = useMemo( () => disabledAgentTabActionIds(disabledTuiAgents), @@ -283,13 +228,25 @@ export function ShortcutsPane(): React.JSX.Element { return } - // Why: the visual editor records one chord at a time; users can still - // manage multi-binding arrays directly in keybindings.json. - if ((await saveBindings(actionId, [captured.value])) && mountedRef.current) { + // Edit just the targeted binding (or append a new one) instead of replacing + // the whole list, so an action's other bindings survive the capture. + const current = getEffectiveKeybindingsForAction(actionId, platform, keybindings) + const next = + recordingBindingIndex === null || recordingBindingIndex >= current.length + ? appendBinding(current, captured.value) + : replaceBindingAt(current, recordingBindingIndex, captured.value) + if ((await saveBindings(actionId, next)) && mountedRef.current) { setRecordingActionId(null) + setRecordingBindingIndex(null) } } + const removeBinding = async (actionId: KeybindingActionId, index: number): Promise => { + setErrors((prev) => ({ ...prev, [actionId]: undefined })) + const current = getEffectiveKeybindingsForAction(actionId, platform, keybindings) + await saveBindings(actionId, removeBindingAt(current, index)) + } + const resetBinding = async (actionId: KeybindingActionId): Promise => { setErrors((prev) => ({ ...prev, [actionId]: undefined })) try { @@ -327,6 +284,9 @@ export function ShortcutsPane(): React.JSX.Element { const clearRecordingForAction = (actionId: KeybindingActionId): void => { // Why: disable/reset are final shortcut edits; the next keypress must not // be captured into the shortcut the user just removed or restored. + if (recordingActionId === actionId) { + setRecordingBindingIndex(null) + } setRecordingActionId((current) => clearRecordingActionForShortcutMutation(current, actionId)) } @@ -396,25 +356,61 @@ export function ShortcutsPane(): React.JSX.Element { /> { + recordingBindingIndex={recordingBindingIndex} + onStartRecordingAt={(actionId, index) => { setRecordingActionId(actionId) + setRecordingBindingIndex(index) clearError(actionId) }} - onCancelRecording={() => setRecordingActionId(null)} + onAppendBinding={(actionId) => { + const current = getEffectiveKeybindingsForAction(actionId, platform, keybindings) + setRecordingActionId(actionId) + setRecordingBindingIndex(current.length) + clearError(actionId) + }} + onCancelRecording={() => { + setRecordingActionId(null) + setRecordingBindingIndex(null) + }} onCapture={(actionId, input) => void captureBinding(actionId, input)} onClearError={clearError} - onDisable={(actionId) => { + onRemoveBindingAt={(actionId, index) => { + // Keep a pending capture aimed at the right row after the removal + // shifts indices (or clear it if the recorded row itself is gone). + if (recordingActionId === actionId) { + const nextIndex = adjustRecordingIndexAfterRemove(recordingBindingIndex, index) + setRecordingBindingIndex(nextIndex) + if (nextIndex === null) { + setRecordingActionId(null) + } + } + void removeBinding(actionId, index) + }} + onResetAction={(actionId) => { + clearRecordingForAction(actionId) + void resetBinding(actionId) + }} + onDisableAction={(actionId) => { + // Remember the current bindings first so "Enable" can restore them. + const current = getEffectiveKeybindingsForAction(actionId, platform, keybindings) + setDisableMemory((memory) => ({ ...memory, [actionId]: current })) clearRecordingForAction(actionId) void disableBinding(actionId) }} - onReset={(actionId) => { - clearRecordingForAction(actionId) - void resetBinding(actionId) + onEnableAction={(actionId) => { + const remembered = disableMemory[actionId] + if (remembered && remembered.length > 0) { + void saveBindings(actionId, remembered) + } }} />
diff --git a/src/renderer/src/components/settings/keybinding-override-edits.ts b/src/renderer/src/components/settings/keybinding-override-edits.ts new file mode 100644 index 000000000..e0e88d007 --- /dev/null +++ b/src/renderer/src/components/settings/keybinding-override-edits.ts @@ -0,0 +1,37 @@ +import type { + KeybindingActionId, + KeybindingFileSnapshot, + KeybindingOverrides +} from '../../../../shared/keybindings' + +// Predicates and edits on the per-action overrides map (distinct from +// shortcut-binding-list-mutations, which edits a single action's binding array). + +export function sameBindings(a: readonly string[], b: readonly string[]): boolean { + return a.length === b.length && a.every((binding, index) => binding === b[index]) +} + +export function hasOwnBindingOverride( + overrides: KeybindingOverrides, + actionId: KeybindingActionId +): boolean { + return Object.prototype.hasOwnProperty.call(overrides, actionId) +} + +export function removeBindingOverride( + overrides: KeybindingOverrides, + actionId: KeybindingActionId +): KeybindingOverrides { + const next = { ...overrides } + delete next[actionId] + return next +} + +// Why: a common (cross-platform) override must be replaced, not deleted, when +// the user resets — deleting only the platform layer would fall back to it. +export function hasCommonBindingOverride( + snapshot: KeybindingFileSnapshot | null, + actionId: KeybindingActionId +): boolean { + return hasOwnBindingOverride(snapshot?.commonOverrides ?? {}, actionId) +} diff --git a/src/renderer/src/components/settings/shortcut-binding-list-mutations.test.ts b/src/renderer/src/components/settings/shortcut-binding-list-mutations.test.ts new file mode 100644 index 000000000..12f196336 --- /dev/null +++ b/src/renderer/src/components/settings/shortcut-binding-list-mutations.test.ts @@ -0,0 +1,87 @@ +import { describe, expect, it } from 'vitest' +import { + adjustRecordingIndexAfterRemove, + appendBinding, + removeBindingAt, + replaceBindingAt +} from './shortcut-binding-list-mutations' + +describe('appendBinding', () => { + it('appends to the end and returns a new array', () => { + const list = ['Cmd+S'] + const next = appendBinding(list, 'Ctrl+S') + expect(next).toEqual(['Cmd+S', 'Ctrl+S']) + expect(next).not.toBe(list) + expect(list).toEqual(['Cmd+S']) + }) + + it('handles an empty list', () => { + expect(appendBinding([], 'Cmd+S')).toEqual(['Cmd+S']) + }) +}) + +describe('replaceBindingAt', () => { + it('replaces the element at the index without changing length', () => { + expect(replaceBindingAt(['a', 'b', 'c'], 1, 'B')).toEqual(['a', 'B', 'c']) + }) + + it('replaces the first and last elements', () => { + expect(replaceBindingAt(['a', 'b', 'c'], 0, 'A')).toEqual(['A', 'b', 'c']) + expect(replaceBindingAt(['a', 'b', 'c'], 2, 'C')).toEqual(['a', 'b', 'C']) + }) + + it('returns an unchanged copy for an out-of-range index', () => { + const list = ['a', 'b'] + expect(replaceBindingAt(list, 5, 'x')).toEqual(['a', 'b']) + expect(replaceBindingAt(list, -1, 'x')).toEqual(['a', 'b']) + expect(replaceBindingAt(list, 5, 'x')).not.toBe(list) + }) + + it('does not mutate the original', () => { + const list = ['a', 'b'] + replaceBindingAt(list, 0, 'A') + expect(list).toEqual(['a', 'b']) + }) +}) + +describe('removeBindingAt', () => { + it('removes the element at the index', () => { + expect(removeBindingAt(['a', 'b', 'c'], 1)).toEqual(['a', 'c']) + }) + + it('removing the only element yields an empty array', () => { + expect(removeBindingAt(['a'], 0)).toEqual([]) + }) + + it('returns an unchanged copy for an out-of-range index', () => { + const list = ['a', 'b'] + expect(removeBindingAt(list, 5)).toEqual(['a', 'b']) + expect(removeBindingAt(list, -1)).toEqual(['a', 'b']) + expect(removeBindingAt(list, 5)).not.toBe(list) + }) + + it('does not mutate the original', () => { + const list = ['a', 'b', 'c'] + removeBindingAt(list, 0) + expect(list).toEqual(['a', 'b', 'c']) + }) +}) + +describe('adjustRecordingIndexAfterRemove', () => { + it('keeps null when nothing is recording', () => { + expect(adjustRecordingIndexAfterRemove(null, 2)).toBeNull() + }) + + it('clears recording when the recorded row is removed', () => { + expect(adjustRecordingIndexAfterRemove(2, 2)).toBeNull() + expect(adjustRecordingIndexAfterRemove(0, 0)).toBeNull() + }) + + it('shifts the index down when a row above it is removed', () => { + expect(adjustRecordingIndexAfterRemove(3, 1)).toBe(2) + }) + + it('leaves the index unchanged when a row below it is removed', () => { + expect(adjustRecordingIndexAfterRemove(1, 3)).toBe(1) + }) +}) diff --git a/src/renderer/src/components/settings/shortcut-binding-list-mutations.ts b/src/renderer/src/components/settings/shortcut-binding-list-mutations.ts new file mode 100644 index 000000000..b7a448c41 --- /dev/null +++ b/src/renderer/src/components/settings/shortcut-binding-list-mutations.ts @@ -0,0 +1,43 @@ +// Pure array operations for editing one action's binding list. The override +// model stores all of an action's bindings in a single array, so adding, +// editing, or removing a single binding means saving a mutated copy of the +// effective list. Kept side-effect-free (no dedupe — saveBindings/ +// normalizeKeybindingListForAction already dedupe) so they stay unit-testable. + +export function appendBinding(list: readonly string[], binding: string): string[] { + return [...list, binding] +} + +export function replaceBindingAt( + list: readonly string[], + index: number, + binding: string +): string[] { + if (index < 0 || index >= list.length) { + return [...list] + } + return list.map((existing, current) => (current === index ? binding : existing)) +} + +export function removeBindingAt(list: readonly string[], index: number): string[] { + if (index < 0 || index >= list.length) { + return [...list] + } + return list.filter((_, current) => current !== index) +} + +// Keeps a pending recording aimed at the right binding after a sibling is +// removed: the recorded row is gone (→ null), rows below it shift up by one, +// rows above are untouched. +export function adjustRecordingIndexAfterRemove( + current: number | null, + removedIndex: number +): number | null { + if (current === null) { + return null + } + if (current === removedIndex) { + return null + } + return current > removedIndex ? current - 1 : current +} diff --git a/src/renderer/src/components/settings/shortcut-terminal-status.ts b/src/renderer/src/components/settings/shortcut-terminal-status.ts new file mode 100644 index 000000000..f8abf54ab --- /dev/null +++ b/src/renderer/src/components/settings/shortcut-terminal-status.ts @@ -0,0 +1,67 @@ +import { + isKeybindingAllowedInTerminal, + isKeybindingPotentialTerminalConflict, + keybindingIsActiveInContext, + type KeybindingDefinition, + type TerminalShortcutPolicy +} from '../../../../shared/keybindings' +import { translate } from '@/i18n/i18n' + +// Describes how a shortcut behaves while a terminal/TUI has keyboard focus, +// surfaced as a badge on the command header. Lives in its own module so the +// command-block, filter rail, and pane can share it without importing a +// component file. +export type ShortcutTerminalStatus = { + label: string + description: string +} + +export function getShortcutTerminalStatus( + definition: KeybindingDefinition, + terminalShortcutPolicy: TerminalShortcutPolicy, + hasEffectiveBinding: boolean +): ShortcutTerminalStatus | undefined { + if (!hasEffectiveBinding) { + return undefined + } + if (definition.scope === 'terminal') { + return { + label: translate('auto.components.settings.ShortcutsPane.cb02e00202', 'Terminal'), + description: translate( + 'auto.components.settings.ShortcutsPane.781cb74d22', + 'Runs from terminal panes.' + ) + } + } + if (isKeybindingAllowedInTerminal(definition)) { + return { + label: translate('auto.components.settings.ShortcutsPane.25b0004fbf', 'Terminal active'), + description: translate( + 'auto.components.settings.ShortcutsPane.3c0fac059a', + 'Still runs while a terminal has keyboard focus.' + ) + } + } + if (!isKeybindingPotentialTerminalConflict(definition)) { + return undefined + } + const activeInTerminal = keybindingIsActiveInContext(definition, { + context: 'terminal', + terminalShortcutPolicy + }) + return activeInTerminal + ? { + label: translate('auto.components.settings.ShortcutsPane.2a0e8aeccf', 'Orca first'), + description: translate( + 'auto.components.settings.ShortcutsPane.dfa8ff612f', + 'Also runs while a terminal or TUI has keyboard focus.' + ) + } + : { + label: translate('auto.components.settings.ShortcutsPane.5c65d5db9d', 'Terminal first'), + description: translate( + 'auto.components.settings.ShortcutsPane.f0b35b0b2e', + 'Disabled while a terminal or TUI has keyboard focus.' + ) + } +} diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index fe9f21d5d..27949da8b 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -5848,19 +5848,6 @@ "df38d612b7": "No projects added yet.", "3e483e256b": "No matching project settings." }, - "ShortcutBindingRow": { - "4a4c2c9d32": "Add shortcut", - "87381fd8f8": "Press keys…", - "9cdaaa3d8f": "Disable shortcut", - "3b62c142fa": "Disable {{value0}}", - "f75335b155": "Reset to default", - "4f2c9b2a05": "Reset {{value0}} to default", - "97dccee14e": "Modified", - "3b11ef3a43": "{{value0}} shortcut", - "f6579be67b": "Change shortcut", - "6a7848fdac": "Listening for shortcut", - "a98d551407": "Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels." - }, "ShortcutFilterRail": { "28b63545bf": "Status", "8a1e78c14b": "Shortcut status filters", @@ -8134,6 +8121,36 @@ "d37e92a06b": "ORCA_DIAGNOSTICS_DISABLED=1 is set — app diagnostics are off.", "5ebb31e1fb": "Running in CI — diagnostics are off.", "e27c8d45bf": "Diagnostics are disabled by an environment variable." + }, + "ShortcutCommandBlock": { + "eb72c52c28": "Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.", + "70b5d25583": "{{value0}} shortcut", + "287e07ddde": "Modified", + "3c83cd7d1c": "Disabled", + "07939d084e": "Reset {{value0}} to default", + "9b02917027": "Reset to default", + "a799f90f82": "Disable {{value0}}", + "25e6e76618": "Disable shortcut", + "035a822ef0": "Add shortcut", + "a0e2ef0e61": "Add another shortcut for {{value0}}", + "245c83af24": "Add another shortcut", + "482a60225d": "Enable {{value0}}", + "6287677c37": "Enable", + "01481b964c": "Add shortcut for {{value0}}" + }, + "ShortcutRecorderButton": { + "1a13bb054d": "Press shortcut keys for {{value0}}. Escape cancels.", + "3732775d74": "Add shortcut for {{value0}}", + "88764af2c1": "Change shortcut for {{value0}}", + "30feb099d6": "Change shortcut {{value0}} of {{value1}} for {{value2}}", + "5d982a2a1f": "Listening for shortcut", + "152e0bcd64": "Add shortcut", + "5bd56445da": "Change shortcut", + "f5ed5dcbf6": "Press keys…" + }, + "ShortcutRemoveButton": { + "9e29aff18b": "Remove {{value0}} shortcut {{value1}}", + "2a9588b1c2": "Remove this binding" } }, "right": { diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json index 41adc3497..faa1fea57 100644 --- a/src/renderer/src/i18n/locales/es.json +++ b/src/renderer/src/i18n/locales/es.json @@ -5811,19 +5811,6 @@ "df38d612b7": "Aún no se han agregado proyectos.", "3e483e256b": "No hay configuraciones de proyecto coincidentes." }, - "ShortcutBindingRow": { - "4a4c2c9d32": "Agregar acceso directo", - "87381fd8f8": "Presione las teclas…", - "9cdaaa3d8f": "Deshabilitar acceso directo", - "3b62c142fa": "Deshabilitar {{value0}}", - "f75335b155": "Restablecer los valores predeterminados", - "4f2c9b2a05": "Restablecer {{value0}} a los valores predeterminados", - "97dccee14e": "Modificado", - "3b11ef3a43": "{{value0}} atajo", - "f6579be67b": "Cambiar acceso directo", - "6a7848fdac": "Escuchando atajos", - "a98d551407": "Pulsa un atajo o toca dos veces una tecla modificadora (p. ej., {{value0}}). Esc cancela." - }, "ShortcutFilterRail": { "28b63545bf": "Estado", "8a1e78c14b": "Filtros de estado de acceso directo", @@ -8134,6 +8121,36 @@ "d37e92a06b": "ORCA_DIAGNOSTICS_DISABLED=1 está configurado: los diagnósticos de la app están desactivados.", "5ebb31e1fb": "Se está ejecutando en CI: los diagnósticos están desactivados.", "e27c8d45bf": "Los diagnósticos están desactivados por una variable de entorno." + }, + "ShortcutCommandBlock": { + "eb72c52c28": "Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.", + "70b5d25583": "{{value0}} shortcut", + "287e07ddde": "Modified", + "3c83cd7d1c": "Disabled", + "07939d084e": "Reset {{value0}} to default", + "9b02917027": "Reset to default", + "a799f90f82": "Disable {{value0}}", + "25e6e76618": "Disable shortcut", + "035a822ef0": "Add shortcut", + "a0e2ef0e61": "Add another shortcut for {{value0}}", + "245c83af24": "Add another shortcut", + "482a60225d": "Enable {{value0}}", + "6287677c37": "Enable", + "01481b964c": "Add shortcut for {{value0}}" + }, + "ShortcutRecorderButton": { + "1a13bb054d": "Press shortcut keys for {{value0}}. Escape cancels.", + "3732775d74": "Add shortcut for {{value0}}", + "88764af2c1": "Change shortcut for {{value0}}", + "30feb099d6": "Change shortcut {{value0}} of {{value1}} for {{value2}}", + "5d982a2a1f": "Listening for shortcut", + "152e0bcd64": "Add shortcut", + "5bd56445da": "Change shortcut", + "f5ed5dcbf6": "Press keys…" + }, + "ShortcutRemoveButton": { + "9e29aff18b": "Remove {{value0}} shortcut {{value1}}", + "2a9588b1c2": "Remove this binding" } }, "right": { diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json index 1e41a750b..bac6e997f 100644 --- a/src/renderer/src/i18n/locales/ja.json +++ b/src/renderer/src/i18n/locales/ja.json @@ -5833,19 +5833,6 @@ "df38d612b7": "まだ追加されたプロジェクトはありません。", "3e483e256b": "一致するプロジェクト設定がありません。" }, - "ShortcutBindingRow": { - "4a4c2c9d32": "ショートカットを追加", - "87381fd8f8": "キーを押してください…", - "9cdaaa3d8f": "ショートカットを無効にする", - "3b62c142fa": "{{value0}} を無効にする", - "f75335b155": "デフォルトにリセットする", - "4f2c9b2a05": "{{value0}} をデフォルトにリセット", - "97dccee14e": "修正済み", - "3b11ef3a43": "{{value0}} ショートカット", - "f6579be67b": "ショートカットを変更する", - "6a7848fdac": "ショートカットを記録中", - "a98d551407": "ショートカットを押すか、修飾キーをダブルタップしてください(例: {{value0}})。Esc でキャンセルします。" - }, "ShortcutFilterRail": { "28b63545bf": "状態", "8a1e78c14b": "ショートカットステータスフィルター", @@ -8134,6 +8121,36 @@ "d37e92a06b": "ORCA_DIAGNOSTICS_DISABLED=1 が設定されています — アプリ診断はオフです。", "5ebb31e1fb": "CI で実行中です — 診断はオフです。", "e27c8d45bf": "環境変数により診断は無効になっています。" + }, + "ShortcutCommandBlock": { + "eb72c52c28": "Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.", + "70b5d25583": "{{value0}} shortcut", + "287e07ddde": "Modified", + "3c83cd7d1c": "Disabled", + "07939d084e": "Reset {{value0}} to default", + "9b02917027": "Reset to default", + "a799f90f82": "Disable {{value0}}", + "25e6e76618": "Disable shortcut", + "035a822ef0": "Add shortcut", + "a0e2ef0e61": "Add another shortcut for {{value0}}", + "245c83af24": "Add another shortcut", + "482a60225d": "Enable {{value0}}", + "6287677c37": "Enable", + "01481b964c": "Add shortcut for {{value0}}" + }, + "ShortcutRecorderButton": { + "1a13bb054d": "Press shortcut keys for {{value0}}. Escape cancels.", + "3732775d74": "Add shortcut for {{value0}}", + "88764af2c1": "Change shortcut for {{value0}}", + "30feb099d6": "Change shortcut {{value0}} of {{value1}} for {{value2}}", + "5d982a2a1f": "Listening for shortcut", + "152e0bcd64": "Add shortcut", + "5bd56445da": "Change shortcut", + "f5ed5dcbf6": "Press keys…" + }, + "ShortcutRemoveButton": { + "9e29aff18b": "Remove {{value0}} shortcut {{value1}}", + "2a9588b1c2": "Remove this binding" } }, "right": { diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json index e232cccac..c8a4d8e68 100644 --- a/src/renderer/src/i18n/locales/ko.json +++ b/src/renderer/src/i18n/locales/ko.json @@ -5796,19 +5796,6 @@ "df38d612b7": "아직 추가된 프로젝트가 없습니다.", "3e483e256b": "일치하는 프로젝트 설정이 없습니다." }, - "ShortcutBindingRow": { - "4a4c2c9d32": "바로가기 추가", - "87381fd8f8": "키를 누르세요…", - "9cdaaa3d8f": "바로가기 비활성화", - "3b62c142fa": "{{value0}} 비활성화", - "f75335b155": "기본값으로 재설정", - "4f2c9b2a05": "{{value0}}을 기본값으로 재설정", - "97dccee14e": "수정됨", - "3b11ef3a43": "{{value0}} 바로가기", - "f6579be67b": "바로가기 변경", - "6a7848fdac": "단축키 입력 대기 중", - "a98d551407": "단축키를 누르거나 보조 키를 두 번 탭하세요(예: {{value0}}). Esc로 취소합니다." - }, "ShortcutFilterRail": { "28b63545bf": "상태", "8a1e78c14b": "바로가기 상태 필터", @@ -8134,6 +8121,36 @@ "d37e92a06b": "ORCA_DIAGNOSTICS_DISABLED=1이 설정되어 있어 앱 진단이 꺼져 있습니다.", "5ebb31e1fb": "CI에서 실행 중입니다. 진단이 꺼져 있습니다.", "e27c8d45bf": "환경 변수로 인해 진단이 비활성화되었습니다." + }, + "ShortcutCommandBlock": { + "eb72c52c28": "Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.", + "70b5d25583": "{{value0}} shortcut", + "287e07ddde": "Modified", + "3c83cd7d1c": "Disabled", + "07939d084e": "Reset {{value0}} to default", + "9b02917027": "Reset to default", + "a799f90f82": "Disable {{value0}}", + "25e6e76618": "Disable shortcut", + "035a822ef0": "Add shortcut", + "a0e2ef0e61": "Add another shortcut for {{value0}}", + "245c83af24": "Add another shortcut", + "482a60225d": "Enable {{value0}}", + "6287677c37": "Enable", + "01481b964c": "Add shortcut for {{value0}}" + }, + "ShortcutRecorderButton": { + "1a13bb054d": "Press shortcut keys for {{value0}}. Escape cancels.", + "3732775d74": "Add shortcut for {{value0}}", + "88764af2c1": "Change shortcut for {{value0}}", + "30feb099d6": "Change shortcut {{value0}} of {{value1}} for {{value2}}", + "5d982a2a1f": "Listening for shortcut", + "152e0bcd64": "Add shortcut", + "5bd56445da": "Change shortcut", + "f5ed5dcbf6": "Press keys…" + }, + "ShortcutRemoveButton": { + "9e29aff18b": "Remove {{value0}} shortcut {{value1}}", + "2a9588b1c2": "Remove this binding" } }, "right": { diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json index ae8498eb6..7076323cb 100644 --- a/src/renderer/src/i18n/locales/zh.json +++ b/src/renderer/src/i18n/locales/zh.json @@ -5796,19 +5796,6 @@ "df38d612b7": "尚未添加项目。", "3e483e256b": "没有匹配的项目设置。" }, - "ShortcutBindingRow": { - "4a4c2c9d32": "添加快捷方式", - "87381fd8f8": "按键...", - "9cdaaa3d8f": "禁用快捷方式", - "3b62c142fa": "禁用 {{value0}}", - "f75335b155": "重置为默认值", - "4f2c9b2a05": "将 {{value0}} 重置为默认值", - "97dccee14e": "修改的", - "3b11ef3a43": "{{value0}} 快捷方式", - "f6579be67b": "更改快捷方式", - "6a7848fdac": "正在录制快捷键", - "a98d551407": "按下快捷键,或双击一个修饰键(例如 {{value0}})。按 Esc 取消。" - }, "ShortcutFilterRail": { "28b63545bf": "状态", "8a1e78c14b": "快捷状态搜索器", @@ -8134,6 +8121,36 @@ "d37e92a06b": "已设置 ORCA_DIAGNOSTICS_DISABLED=1,应用诊断已关闭。", "5ebb31e1fb": "正在 CI 中运行,诊断已关闭。", "e27c8d45bf": "诊断已被环境变量停用。" + }, + "ShortcutCommandBlock": { + "eb72c52c28": "Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.", + "70b5d25583": "{{value0}} shortcut", + "287e07ddde": "Modified", + "3c83cd7d1c": "Disabled", + "07939d084e": "Reset {{value0}} to default", + "9b02917027": "Reset to default", + "a799f90f82": "Disable {{value0}}", + "25e6e76618": "Disable shortcut", + "035a822ef0": "Add shortcut", + "a0e2ef0e61": "Add another shortcut for {{value0}}", + "245c83af24": "Add another shortcut", + "482a60225d": "Enable {{value0}}", + "6287677c37": "Enable", + "01481b964c": "Add shortcut for {{value0}}" + }, + "ShortcutRecorderButton": { + "1a13bb054d": "Press shortcut keys for {{value0}}. Escape cancels.", + "3732775d74": "Add shortcut for {{value0}}", + "88764af2c1": "Change shortcut for {{value0}}", + "30feb099d6": "Change shortcut {{value0}} of {{value1}} for {{value2}}", + "5d982a2a1f": "Listening for shortcut", + "152e0bcd64": "Add shortcut", + "5bd56445da": "Change shortcut", + "f5ed5dcbf6": "Press keys…" + }, + "ShortcutRemoveButton": { + "9e29aff18b": "Remove {{value0}} shortcut {{value1}}", + "2a9588b1c2": "Remove this binding" } }, "right": {