feat(app): add global shortcut help dialog

This commit is contained in:
Mohamed Boudra
2026-02-14 20:18:28 +07:00
parent 756f9a7972
commit 9da5b26db0
8 changed files with 278 additions and 1 deletions
@@ -55,6 +55,17 @@ function hasDigit(event: KeyboardEvent): boolean {
return parseDigit(event) !== null;
}
function isQuestionMarkShortcut(event: KeyboardEvent): boolean {
return (
!event.metaKey &&
!event.ctrlKey &&
!event.altKey &&
event.shiftKey &&
!event.repeat &&
(event.key === "?" || event.code === "Slash")
);
}
function withMessageInputAction(
kind: MessageInputKeyboardActionKind
): (event: KeyboardEvent) => KeyboardShortcutPayload {
@@ -92,6 +103,12 @@ const SHORTCUT_BINDINGS: readonly KeyboardShortcutBinding[] = [
(event.code === "KeyK" || event.key.toLowerCase() === "k"),
when: () => true,
},
{
id: "shortcuts-dialog-toggle-question-mark",
action: "shortcuts.dialog.toggle",
matches: isQuestionMarkShortcut,
when: (context) => context.focusScope === "other",
},
{
id: "sidebar-toggle-left-mac-cmd-b",
action: "sidebar.toggle.left",
@@ -179,7 +196,7 @@ const SHORTCUT_BINDINGS: readonly KeyboardShortcutBinding[] = [
!event.repeat,
payload: withMessageInputAction("voice-mute-toggle"),
when: (context) =>
!context.commandCenterOpen && context.focusScope !== "terminal",
!context.commandCenterOpen && context.focusScope === "other",
},
{
id: "sidebar-shortcut-alt-digit",