fix: don't crash when focusing an app that was closed (closes #19)
This commit is contained in:
1 parent
8773b1dceb
commit
6b5e426e05
1 file changed
+4
-2
@@ -26,8 +26,10 @@ class OpenWindow {
|
||||
}
|
||||
|
||||
func focus() {
|
||||
NSRunningApplication(processIdentifier: ownerPid!)!.activate(options: [.activateIgnoringOtherApps])
|
||||
AXUIElementPerformAction(target!, kAXRaiseAction as CFString)
|
||||
if let app = NSRunningApplication(processIdentifier: ownerPid!) {
|
||||
app.activate(options: [.activateIgnoringOtherApps])
|
||||
AXUIElementPerformAction(target!, kAXRaiseAction as CFString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user