feat: add Open as the default application action
This commit is contained in:
@@ -44,7 +44,11 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
super.init(window: window)
|
||||
configureContent(in: window)
|
||||
window.delegate = self
|
||||
window.navigateSelection = { [weak self] offset in self?.moveSelection(by: offset) }
|
||||
window.navigateSelection = { [weak self] offset in
|
||||
guard let self else { return }
|
||||
if self.actions.isShown { self.actions.moveSelection(by: offset) }
|
||||
else { self.moveSelection(by: offset) }
|
||||
}
|
||||
window.dismiss = { [weak self] in self?.dismiss() }
|
||||
window.dragEnded = { [weak self] in
|
||||
guard let self else { return }
|
||||
@@ -494,6 +498,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
@objc private func showActions() {
|
||||
guard !isLaunching, window?.attachedSheet == nil, results.indices.contains(tableView.selectedRow) else { return }
|
||||
let application = results[tableView.selectedRow]
|
||||
actions.open = { [weak self] in self?.openApplication(application) }
|
||||
actions.uninstall = { [weak self] in self?.reviewUninstall(application) }
|
||||
actions.show(for: application, relativeTo: actionsButton)
|
||||
openButton.keyEquivalent = actions.isShown ? "" : "\r"
|
||||
@@ -517,8 +522,12 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
}
|
||||
|
||||
@objc private func openSelection() {
|
||||
guard !isLaunching, results.indices.contains(tableView.selectedRow) else { return }
|
||||
let application = results[tableView.selectedRow]
|
||||
guard results.indices.contains(tableView.selectedRow) else { return }
|
||||
openApplication(results[tableView.selectedRow])
|
||||
}
|
||||
|
||||
private func openApplication(_ application: Application) {
|
||||
guard !isLaunching else { return }
|
||||
isLaunching = true
|
||||
updateOpenButton()
|
||||
Task {
|
||||
|
||||
Reference in New Issue
Block a user