feat: add Finder, ranking reset, and quit actions

This commit is contained in:
2026-10-13 17:38:29 +02:00
parent 7cfd8096a4
commit 400917de3b
7 changed files with 90 additions and 4 deletions
@@ -505,6 +505,16 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
guard !isLaunching, launcherFrameBeforeReview == nil, window?.attachedSheet == nil, results.indices.contains(tableView.selectedRow) else { return }
let application = results[tableView.selectedRow]
actions.open = { [weak self] in self?.openApplication(application) }
actions.showInFinder = { [weak self] in
self?.dismiss(restoringFocus: false)
NSWorkspace.shared.activateFileViewerSelecting([application.url])
}
actions.resetRanking = { [weak self] in
guard let self else { return }
self.history.resetRanking(of: application)
self.updateResults(preservingSelection: true)
}
actions.quit = { [weak self] in self?.quitApplication(application) }
actions.uninstall = { [weak self] in self?.reviewUninstall(application) }
actions.show(for: application, relativeTo: actionsButton)
openButton.keyEquivalent = actions.isShown ? "" : "\r"
@@ -576,6 +586,17 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
openApplication(results[tableView.selectedRow])
}
private func quitApplication(_ application: Application) {
do {
try AppLauncher.quit(application.url)
dismiss()
} catch {
let alert = NSAlert(error: error)
alert.messageText = "Couldn’t quit \(application.name)"
if let window { alert.beginSheetModal(for: window) }
}
}
private func openApplication(_ application: Application) {
guard !isLaunching else { return }
isLaunching = true