Search window hides immediately after opening.
This commit is contained in:
@@ -206,7 +206,6 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
||||
}
|
||||
|
||||
settingsPopover.delegate = self
|
||||
|
||||
searchInput.delegate = self
|
||||
|
||||
tableScrollView.documentView = programsTableView
|
||||
@@ -255,14 +254,7 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
||||
|
||||
@objc
|
||||
func openSettings() {
|
||||
// HACK: This is an interesting behavior. When NSPopover appears
|
||||
// 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)
|
||||
settingsPopover.show(relativeTo: settingsButton.bounds, of: settingsButton, preferredEdge: .maxY)
|
||||
}
|
||||
|
||||
@objc
|
||||
@@ -275,20 +267,13 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
||||
let url = URL(fileURLWithPath: program.path).appendingPathComponent(program.name+program.ext)
|
||||
let config = NSWorkspace.OpenConfiguration()
|
||||
|
||||
// NOTE: This needs a window! Do not just copy-paste this block elsewhere.
|
||||
NSWorkspace.shared.openApplication(at: url, configuration: config) { [weak self] application, error in
|
||||
if let error = error {
|
||||
print("\(error.localizedDescription)")
|
||||
} else {
|
||||
print("Program opened successfully")
|
||||
DispatchQueue.main.async {
|
||||
NSWorkspace.shared.openApplication(at: url, configuration: config)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
if let window = self?.view.window {
|
||||
window.resignKey()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func controlTextDidChange(_ obj: Notification) {
|
||||
guard let searchInput = obj.object as? EditableNSTextField else { return }
|
||||
|
||||
Reference in New Issue
Block a user