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:
2026-10-08 10:43:42 +08:00
parent 1bd346ce20
commit 962c205d1d
5 changed files with 75 additions and 1 deletions
+2
View File
@@ -31,12 +31,14 @@ final class PanelController: NSObject {
}
NSApp.activate(ignoringOtherApps: true)
panel.makeKeyAndOrderFront(nil)
NSLog("Prompt: panel shown")
NotificationCenter.default.post(name: .promptPanelDidShow, object: nil)
}
func hide() {
panel?.orderOut(nil)
NSApp.deactivate()
NSLog("Prompt: panel hidden (app keeps running for the Shift-Shift hotkeys)")
}
private func makePanel() -> KeyablePanel {