fix: initial discovery when single space was glitching the os
This commit is contained in:
1 parent
a3c0fe820f
commit
3cd4b6d068
1 file changed
+15
-6
@@ -21,16 +21,25 @@ class Applications {
|
|||||||
|
|
||||||
static func addInitialRunningApplicationsWindows() {
|
static func addInitialRunningApplicationsWindows() {
|
||||||
// on initial launch, we use private APIs to bring windows from other spaces into the current space, observe them, then remove them from the current space
|
// on initial launch, we use private APIs to bring windows from other spaces into the current space, observe them, then remove them from the current space
|
||||||
let windows = Spaces.windowsInSpaces(Spaces.otherSpaces()).filter { window in
|
let spaces = Spaces.otherSpaces()
|
||||||
|
if spaces.count == 0 {
|
||||||
|
Windows.sortByLevel()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let windows = Spaces.windowsInSpaces(spaces).filter { window in
|
||||||
return Windows.list.first(where: { $0.cgWindowId == window }) == nil
|
return Windows.list.first(where: { $0.cgWindowId == window }) == nil
|
||||||
}
|
}
|
||||||
CGSAddWindowsToSpaces(cgsMainConnectionId, windows as NSArray, [Spaces.currentSpaceId])
|
if windows.count > 0 {
|
||||||
for app in list {
|
CGSAddWindowsToSpaces(cgsMainConnectionId, windows as NSArray, [Spaces.currentSpaceId])
|
||||||
guard app.runningApplication.isFinishedLaunching else { continue }
|
for app in list {
|
||||||
app.observeNewWindows()
|
guard app.runningApplication.isFinishedLaunching else { continue }
|
||||||
|
app.observeNewWindows()
|
||||||
|
}
|
||||||
|
Windows.sortByLevel()
|
||||||
|
CGSRemoveWindowsFromSpaces(cgsMainConnectionId, windows as NSArray, [Spaces.currentSpaceId])
|
||||||
|
return
|
||||||
}
|
}
|
||||||
Windows.sortByLevel()
|
Windows.sortByLevel()
|
||||||
CGSRemoveWindowsFromSpaces(cgsMainConnectionId, windows as NSArray, [Spaces.currentSpaceId])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func addRunningApplications(_ runningApps: [NSRunningApplication]) {
|
static func addRunningApplications(_ runningApps: [NSRunningApplication]) {
|
||||||
|
|||||||
Reference in new issue
Block a user