Status: ratified — shipped 2026-04-26 (Sources/OpenQuackKit/Hotkey/HotkeyManager.swift)
Owner: OpenQuackKit/Hotkey/
Last updated: 2026-04-26
A global hotkey toggles recording. While recording, a separate cancel hotkey discards the buffer. Defaults: ⌃⇧Space (toggle), Esc while overlay is focused (cancel).
public extension KeyboardShortcuts.Name {
static let toggleRecording = Self("openquack.toggleRecording")
static let cancelRecording = Self("openquack.cancelRecording")
}
public final class HotkeyManager {
public init()
public func register(toggle: @escaping () -> Void, cancel: @escaping () -> Void)
public func unregister()
}
Implementation uses sindresorhus/KeyboardShortcuts (MIT). The package handles persistence to UserDefaults, conflict resolution with system shortcuts, and the SwiftUI Recorder UI for Settings.
register(...) wires KeyboardShortcuts.onKeyDown(for: .toggleRecording, action: toggle) etc.toggle callback fires on key-down (not up). Recording starts on first press, stops on next press.cancel callback fires only when overlay window is key (don’t shadow Esc globally).register becomes a no-op for that one.KeyboardShortcuts works inside the App Sandbox. No Accessibility permission needed for the hotkey itself — but our paste service (SPEC-005) does need Accessibility. Surface the two requirements separately.
F5)? Allow it, but warn in the Recorder UI.RegisterEventHotKey. KeyboardShortcuts is a thin wrapper over the same; no functional difference.