fix: cpu usage higher than normal for 2min after quitting an app
This commit is contained in:
1 parent
40ef0091b7
commit
2f4c56c9dd
1 file changed
+12
-10
@@ -30,18 +30,20 @@ fileprivate func handleEvent(_ type: String, _ element: AXUIElement) throws {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func focusedUiElementChanged(_ element: AXUIElement, _ pid: pid_t) throws {
|
fileprivate func focusedUiElementChanged(_ element: AXUIElement, _ pid: pid_t) throws {
|
||||||
let currentWindows = try AXUIElementCreateApplication(pid).windows()
|
if NSRunningApplication(processIdentifier: pid) != nil {
|
||||||
DispatchQueue.main.async {
|
let currentWindows = try AXUIElementCreateApplication(pid).windows()
|
||||||
let windows = Windows.list.filter { w in
|
DispatchQueue.main.async {
|
||||||
if w.application.pid == pid && pid != ProcessInfo.processInfo.processIdentifier &&
|
let windows = Windows.list.filter { w in
|
||||||
w.spaceId == Spaces.currentSpaceId {
|
if w.application.pid == pid && pid != ProcessInfo.processInfo.processIdentifier &&
|
||||||
let oldIsTabbed = w.isTabbed
|
w.spaceId == Spaces.currentSpaceId {
|
||||||
w.isTabbed = (currentWindows?.first { $0 == w.axUiElement } == nil)
|
let oldIsTabbed = w.isTabbed
|
||||||
return oldIsTabbed != w.isTabbed
|
w.isTabbed = (currentWindows?.first { $0 == w.axUiElement } == nil)
|
||||||
|
return oldIsTabbed != w.isTabbed
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return false
|
App.app.refreshOpenUi(windows)
|
||||||
}
|
}
|
||||||
App.app.refreshOpenUi(windows)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user