Make the app reachable and quittable after the panel closes
Closing the panel only hid it, and launching the app again did nothing because the running instance ignored the reopen, so it looked like the app refused to exit. Reopening now shows the panel, and the main menu makes Cmd+Q and Cmd+W work while the panel has focus. Termination also tears down the event tap, hotkeys and sync timers instead of leaving them live.
This commit is contained in:
@@ -34,6 +34,22 @@ final class HotkeyManager {
|
||||
registerFallbackHotkeys()
|
||||
}
|
||||
|
||||
func stop() {
|
||||
if let tap = eventTap {
|
||||
CGEvent.tapEnable(tap: tap, enable: false)
|
||||
CFMachPortInvalidate(tap)
|
||||
}
|
||||
if let source = runLoopSource {
|
||||
CFRunLoopRemoveSource(CFRunLoopGetMain(), source, .commonModes)
|
||||
}
|
||||
for ref in hotKeyRefs {
|
||||
if let ref { UnregisterEventHotKey(ref) }
|
||||
}
|
||||
hotKeyRefs.removeAll()
|
||||
eventTap = nil
|
||||
runLoopSource = nil
|
||||
}
|
||||
|
||||
// MARK: - Double-Shift event tap
|
||||
|
||||
private func startEventTap() {
|
||||
|
||||
Reference in New Issue
Block a user