fix: dismiss active launcher window on Escape

This commit is contained in:
2026-10-17 00:05:20 +02:00
parent bc7e4fd013
commit a891d49bb1
10 changed files with 98 additions and 50 deletions
@@ -25,6 +25,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
private var window: NSWindow? { view.window }
var closed: (() -> Void)?
var changed: (() -> Void)?
var canClose: Bool { !busy }
init(application: Application, uninstaller: ApplicationUninstaller) {
self.application = application
@@ -117,7 +118,6 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
table.allowsEmptySelection = false
table.setAccessibilityLabel("Files to uninstall for \(application.name)")
table.toggle = { [weak self] in self?.toggleHighlighted() }
table.dismiss = { [weak self] in self?.goBack() }
let scroll = NSScrollView()
scroll.documentView = table
scroll.hasVerticalScroller = true
@@ -229,7 +229,6 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
case #selector(NSResponder.moveDown(_:)): moveSelection(1)
case #selector(NSResponder.moveUp(_:)): moveSelection(-1)
case #selector(NSResponder.insertNewline(_:)): toggleHighlighted()
case #selector(NSResponder.cancelOperation(_:)): goBack()
default: return false
}
return true
@@ -391,10 +390,8 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
}
}
override func cancelOperation(_ sender: Any?) { goBack() }
@objc func goBack() {
guard !busy else { return }
guard canClose else { return }
scanTask?.cancel()
(view as! UninstallReviewContent).acceptsInteraction = false
view.setAccessibilityHidden(true)
@@ -467,10 +464,8 @@ private final class UninstallFileCell: NSTableCellView {
@MainActor
private final class UninstallFilesTable: NSTableView {
var toggle: (() -> Void)?
var dismiss: (() -> Void)?
override func keyDown(with event: NSEvent) {
if [36, 76, 49].contains(event.keyCode), event.modifierFlags.intersection([.command, .option, .control]).isEmpty { toggle?() }
else if event.keyCode == 53 { dismiss?() }
else { super.keyDown(with: event) }
}
}