Skip to content

Commit b1961fa

Browse files
committed
fix(spaces): dispatch Space behavior to main thread
1 parent 8c06dfa commit b1961fa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

maclib/tray.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,13 @@ public func tray_set_icons_for_appearance(
560560
/// switching back to the Space where it was originally created.
561561
@_cdecl("tray_set_windows_move_to_active_space")
562562
public func tray_set_windows_move_to_active_space() {
563-
for window in NSApp.windows {
564-
window.collectionBehavior.insert(.moveToActiveSpace)
563+
let doWork = {
564+
for window in NSApp.windows {
565+
window.collectionBehavior.insert(.moveToActiveSpace)
566+
}
565567
}
568+
if Thread.isMainThread { doWork() }
569+
else { DispatchQueue.main.sync { doWork() } }
566570
}
567571

568572
// MARK: - Dock visibility

0 commit comments

Comments
 (0)