fix: discover windows when switching spaces (#1324)
This commit is contained in:
1 parent
b72c4db334
commit
9c26d54eda
2 files changed
+7
-1
No files matched your search
@@ -6,12 +6,16 @@ class Applications {
|
||||
|
||||
static func manuallyUpdateWindowsFor2s() {
|
||||
let group = DispatchGroup()
|
||||
manuallyUpdateWindows(group)
|
||||
_ = group.wait(wallTimeout: .now() + .seconds(2))
|
||||
}
|
||||
|
||||
static func manuallyUpdateWindows(_ group: DispatchGroup? = nil) {
|
||||
for app in list {
|
||||
if app.runningApplication.isFinishedLaunching && app.runningApplication.activationPolicy != .prohibited {
|
||||
app.manuallyUpdateWindows(group)
|
||||
}
|
||||
}
|
||||
_ = group.wait(wallTimeout: .now() + .seconds(2))
|
||||
}
|
||||
|
||||
static func initialDiscovery() {
|
||||
|
||||
@@ -14,6 +14,8 @@ class Spaces {
|
||||
updateCurrentSpace()
|
||||
// if UI was kept open during Space transition, the Spaces may be obsolete; we refresh them
|
||||
Windows.list.forEachAsync { $0.updatesWindowSpace() }
|
||||
// from macos 12.2 beta onwards, we can't get other-space windows; grabbing windows when switching spaces mitigates the issue
|
||||
Applications.manuallyUpdateWindows()
|
||||
})
|
||||
NSWorkspace.shared.notificationCenter.addObserver(forName: NSApplication.didChangeScreenParametersNotification, object: nil, queue: nil, using: { _ in
|
||||
debugPrint("OS event", "didChangeScreenParametersNotification")
|
||||
|
||||
Reference in new issue
Block a user