fix: space numbers are correctly removed if single space

This commit is contained in:
louis.pontoise authored and lwouis committed 2019-12-30 18:37:22 +09:00
1 parent 1e210c382a
commit 45ad43f347
1 file changed
+12 -1
+12 -1
View File
@@ -17,13 +17,24 @@ class TrackedWindows {
list.removeAll()
focusedWindowIndex = 0
let spaces = Spaces.allIdsAndIndexes()
Spaces.singleSpace = spaces.count == 1
Spaces.currentSpaceId = CGSManagedDisplayGetCurrentSpace(cgsMainConnectionId, Screen.mainUuid())
Spaces.currentSpaceIndex = spaces.first { $0.0 == Spaces.currentSpaceId }!.1
filterAndAddToList(mapWindowsWithRankAndSpace(spaces))
isSingleSpace()
sortList()
}
private class func isSingleSpace() {
let firstSpaceIndex = list[0].spaceIndex
for window in list {
if window.spaceIndex != firstSpaceIndex {
Spaces.singleSpace = false
return
}
}
Spaces.singleSpace = true
}
private static func mapWindowsWithRankAndSpace(_ spaces: [(CGSSpaceID, SpaceIndex)]) -> [CGWindowID: (CGSSpaceID, SpaceIndex, WindowRank)] {
var windowSpaceMap: [CGWindowID: (CGSSpaceID, SpaceIndex, WindowRank?)] = [:]
for (spaceId, spaceIndex) in spaces {