Files
multica/packages/core/shortcuts/index.ts
Jiayuan Zhang b72bd55d16 feat(shortcuts): make browser-reserved accelerators recordable on desktop (#5327)
* feat(shortcuts): make browser-reserved accelerators recordable on desktop

Cmd/Ctrl+P (and L/T/N/D/U) were rejected by the shortcut recorder on every
platform because a browser tab cannot reliably own them. The Electron
renderer receives these as plain keydowns — neither Electron's default menu
nor the desktop shell binds any of them — so the reservation now only
applies to the web runtime.

Adds a ShortcutRuntime dimension (configured by CoreProvider from the
client identity, with a preload-global fallback that is already correct at
module-eval time so store hydration sanitizes with the right runtime).
App-owned accelerators (W/R/Q, editing keys, zoom row) stay reserved
everywhere.

Closes MUL-4457

Co-authored-by: multica-agent <github@multica.ai>

* fix(shortcuts): limit desktop unlock to bare primary browser accelerators

Review follow-up (MUL-4457): the desktop skip matched primary+key with any
extra modifiers, which would also unreserve OS-owned combos such as
Option+Cmd+D (macOS Dock toggle) and Ctrl+Alt+T (Linux terminal). Only the
bare primary chord is now recordable on desktop; every extra-modifier
variant keeps the historical reservation on both runtimes. Adds regression
tests for the OS combos.

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: Lambda <lambda@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-13 16:05:30 +08:00

37 lines
795 B
TypeScript

export {
SHORTCUT_ACTIONS,
SHORTCUT_ACTION_BY_ID,
createShortcutChord,
shortcutFromEvent,
shortcutChordEquals,
shortcutMatchesEvent,
isPlainShortcut,
formatShortcut,
isEditableShortcutTarget,
isReservedShortcut,
isShortcutAllowedForAction,
type ShortcutActionDefinition,
type ShortcutActionId,
type ShortcutCategory,
type ShortcutChord,
type ShortcutModifiers,
} from "./definitions";
export {
configureShortcutPlatform,
configureShortcutRuntime,
detectShortcutPlatform,
detectShortcutRuntime,
getShortcutPlatform,
getShortcutRuntime,
type ShortcutPlatform,
type ShortcutRuntime,
} from "./platform";
export {
useShortcutStore,
useShortcut,
resolveShortcut,
getShortcut,
findShortcutConflict,
type ShortcutOverrides,
} from "./store";