fix: apps would not quit properly sometimes (regression from 10b2c71)
This commit is contained in:
1 parent
657c9e5e8b
commit
41384d9066
1 file changed
+4
-3
@@ -49,13 +49,14 @@ class Applications {
|
||||
static func removeRunningApplications(_ runningApps: [NSRunningApplication]) {
|
||||
var windowsOnTheLeftOfFocusedWindow = 0
|
||||
for runningApp in runningApps {
|
||||
Applications.list.removeAll(where: { $0.pid == runningApp.processIdentifier })
|
||||
// comparing pid here can fail here, as it can be already nil; we use isEqual here to avoid the issue
|
||||
Applications.list.removeAll(where: { $0.runningApplication.isEqual(runningApp) })
|
||||
Windows.list.enumerated().forEach { (index, window) in
|
||||
if window.application.pid == runningApp.processIdentifier && index < Windows.focusedWindowIndex {
|
||||
if window.application.runningApplication.isEqual(runningApp) && index < Windows.focusedWindowIndex {
|
||||
windowsOnTheLeftOfFocusedWindow += 1
|
||||
}
|
||||
}
|
||||
Windows.list.removeAll(where: { $0.application.pid == runningApp.processIdentifier })
|
||||
Windows.list.removeAll(where: { $0.application.runningApplication.isEqual(runningApp) })
|
||||
}
|
||||
guard Windows.list.count > 0 else { App.app.hideUi(); return }
|
||||
if windowsOnTheLeftOfFocusedWindow > 0 {
|
||||
|
||||
Reference in new issue
Block a user