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 {
|
||||
let currentWindows = try AXUIElementCreateApplication(pid).windows()
|
||||
DispatchQueue.main.async {
|
||||
let windows = Windows.list.filter { w in
|
||||
if w.application.pid == pid && pid != ProcessInfo.processInfo.processIdentifier &&
|
||||
w.spaceId == Spaces.currentSpaceId {
|
||||
let oldIsTabbed = w.isTabbed
|
||||
w.isTabbed = (currentWindows?.first { $0 == w.axUiElement } == nil)
|
||||
return oldIsTabbed != w.isTabbed
|
||||
if NSRunningApplication(processIdentifier: pid) != nil {
|
||||
let currentWindows = try AXUIElementCreateApplication(pid).windows()
|
||||
DispatchQueue.main.async {
|
||||
let windows = Windows.list.filter { w in
|
||||
if w.application.pid == pid && pid != ProcessInfo.processInfo.processIdentifier &&
|
||||
w.spaceId == Spaces.currentSpaceId {
|
||||
let 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