Skip to content

Commit

Permalink
fix: space numbers are correctly removed if single space
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Dec 30, 2019
1 parent 1e210c3 commit 45ad43f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion alt-tab-macos/logic/TrackedWindows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 45ad43f

Please sign in to comment.