Context
Snapcap registers two system-wide shortcuts: ⌥⇧⌘R (start/stop) and ⌥⇧⌘P (pause/resume). They're hard-coded, so they can clash with other apps and some keyboard layouts. Settings already has a read-only "Keyboard shortcuts" section whose footer says custom shortcuts are on the roadmap.
GlobalHotKey wraps Carbon's RegisterEventHotKey, which needs no Accessibility permission. It takes a virtual key code plus Carbon modifier flags, returns nil when registration fails, and unregisters in deinit.
Where to look
Sources/Snapcap/App/GlobalHotKey.swift: the wrapper.
Sources/Snapcap/App/AppDelegate.swift: applicationDidFinishLaunching builds hotKeys with kVK_ANSI_R / kVK_ANSI_P and cmdKey | optionKey | shiftKey. makeMainMenu() hard-codes the same shortcuts on File → Start / Stop Recording and Pause / Resume Recording.
Sources/Snapcap/App/StatusItemController.swift: buildMenu() sets the same key equivalents.
Sources/Snapcap/Views/SettingsView.swift: the "Keyboard shortcuts" section (Shortcut view).
- Hard-coded hints:
RecordBar in Sources/Snapcap/Views/RecorderView.swift, the footer of Sources/Snapcap/Views/QuickRecordView.swift, and the HUDButton help strings in Sources/Snapcap/Windows/RecordingPanels.swift.
Proposal
- Add a small
Codable KeyboardShortcut-style value (key code + modifiers) that can produce its display string ("⌥⇧⌘R"), Carbon modifiers and NSEvent.ModifierFlags. Put the pure parts in SnapcapCore so they can be unit tested.
- In Settings, replace the read-only rows with a recorder control: click it, press a combination, done. Esc cancels, and there's a "Reset to default" button. Require at least one of ⌘, ⌥ or ⌃.
- Persist the shortcuts in
UserDefaults, and re-register on change by dropping the old GlobalHotKey and creating a new one.
- If registration fails, show "This shortcut is in use by another app" and keep the previous one.
Acceptance criteria
Context
Snapcap registers two system-wide shortcuts: ⌥⇧⌘R (start/stop) and ⌥⇧⌘P (pause/resume). They're hard-coded, so they can clash with other apps and some keyboard layouts. Settings already has a read-only "Keyboard shortcuts" section whose footer says custom shortcuts are on the roadmap.
GlobalHotKeywraps Carbon'sRegisterEventHotKey, which needs no Accessibility permission. It takes a virtual key code plus Carbon modifier flags, returnsnilwhen registration fails, and unregisters indeinit.Where to look
Sources/Snapcap/App/GlobalHotKey.swift: the wrapper.Sources/Snapcap/App/AppDelegate.swift:applicationDidFinishLaunchingbuildshotKeyswithkVK_ANSI_R/kVK_ANSI_PandcmdKey | optionKey | shiftKey.makeMainMenu()hard-codes the same shortcuts on File → Start / Stop Recording and Pause / Resume Recording.Sources/Snapcap/App/StatusItemController.swift:buildMenu()sets the same key equivalents.Sources/Snapcap/Views/SettingsView.swift: the "Keyboard shortcuts" section (Shortcutview).RecordBarinSources/Snapcap/Views/RecorderView.swift, the footer ofSources/Snapcap/Views/QuickRecordView.swift, and theHUDButtonhelp strings inSources/Snapcap/Windows/RecordingPanels.swift.Proposal
CodableKeyboardShortcut-style value (key code + modifiers) that can produce its display string ("⌥⇧⌘R"), Carbon modifiers andNSEvent.ModifierFlags. Put the pure parts inSnapcapCoreso they can be unit tested.UserDefaults, and re-register on change by dropping the oldGlobalHotKeyand creating a new one.Acceptance criteria