Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix: convert special keys to valid Electron accelerators
Yauheni Bandziukevichd86c17407a70
diff --git a/electron/globalShortcut.ts b/electron/globalShortcut.tsindex c0093044e..a05c52d80 100644--- a/electron/globalShortcut.ts+++ b/electron/globalShortcut.ts@@ -5,12 +5,34 @@ import { SHORTCUTS_FILE } from "./ipc/handlers";const DEFAULT_OPEN_APP_BINDING: ShortcutBinding = { key: "o", ctrl: true, shift: true };+// Maps KeyboardEvent.key values to Electron accelerator key names+const KEY_TO_ACCELERATOR: Record<string, string> = {+ " ": "Space",+ "+": "Plus",+ "-": "numsub",+ "*": "nummult",+ "/": "numdiv",+ arrowup: "Up",+ arrowdown: "Down",+ arrowleft: "Left",+ arrowright: "Right",+ escape: "Escape",+ enter: "Return",+ backspace: "Backspace",+ delete: "Delete",+ tab: "Tab",+};+function bindingToAccelerator(binding: ShortcutBinding): string {const parts: string[] = [];if (binding.ctrl) parts.push("CommandOrControl");if (binding.shift) parts.push("Shift");if (binding.alt) parts.push("Alt");- parts.push(binding.key.toUpperCase());++ const keyLower = binding.key.toLowerCase();+ const acceleratorKey = KEY_TO_ACCELERATOR[keyLower] ?? binding.key.toUpperCase();+ parts.push(acceleratorKey);+return parts.join("+");}