Search window hides immediately after opening.
This commit is contained in:
@@ -206,7 +206,6 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
|||||||
}
|
}
|
||||||
|
|
||||||
settingsPopover.delegate = self
|
settingsPopover.delegate = self
|
||||||
|
|
||||||
searchInput.delegate = self
|
searchInput.delegate = self
|
||||||
|
|
||||||
tableScrollView.documentView = programsTableView
|
tableScrollView.documentView = programsTableView
|
||||||
@@ -255,14 +254,7 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
|||||||
|
|
||||||
@objc
|
@objc
|
||||||
func openSettings() {
|
func openSettings() {
|
||||||
// HACK: This is an interesting behavior. When NSPopover appears
|
settingsPopover.show(relativeTo: settingsButton.bounds, of: settingsButton, preferredEdge: .maxY)
|
||||||
// the first time, it always displays in the wrong location;
|
|
||||||
// however, showing it twice does result in the right
|
|
||||||
// location.
|
|
||||||
settingsPopover.show(relativeTo: settingsButton.bounds,
|
|
||||||
of: settingsButton, preferredEdge: .maxY)
|
|
||||||
settingsPopover.show(relativeTo: settingsButton.bounds,
|
|
||||||
of: settingsButton, preferredEdge: .maxY)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
@@ -275,17 +267,10 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
|||||||
let url = URL(fileURLWithPath: program.path).appendingPathComponent(program.name+program.ext)
|
let url = URL(fileURLWithPath: program.path).appendingPathComponent(program.name+program.ext)
|
||||||
let config = NSWorkspace.OpenConfiguration()
|
let config = NSWorkspace.OpenConfiguration()
|
||||||
|
|
||||||
// NOTE: This needs a window! Do not just copy-paste this block elsewhere.
|
NSWorkspace.shared.openApplication(at: url, configuration: config)
|
||||||
NSWorkspace.shared.openApplication(at: url, configuration: config) { [weak self] application, error in
|
DispatchQueue.main.async { [weak self] in
|
||||||
if let error = error {
|
if let window = self?.view.window {
|
||||||
print("\(error.localizedDescription)")
|
window.resignKey()
|
||||||
} else {
|
|
||||||
print("Program opened successfully")
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
if let window = self?.view.window {
|
|
||||||
window.resignKey()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user