diff --git a/src/logic/Spaces.swift b/src/logic/Spaces.swift index bbaa0d0f..7d2c4c16 100644 --- a/src/logic/Spaces.swift +++ b/src/logic/Spaces.swift @@ -72,7 +72,7 @@ class Spaces { static func windowsInSpaces(_ spaceIds: [CGSSpaceID], _ options: CGSCopyWindowsOptions) -> [CGWindowID] { var set_tags = ([] as CGSCopyWindowsTags).rawValue var clear_tags = ([] as CGSCopyWindowsTags).rawValue - return CGSCopyWindowsWithOptionsAndTags(cgsMainConnectionId, 0, spaceIds as CFArray, 2, &set_tags, &clear_tags) as! [CGWindowID] + return CGSCopyWindowsWithOptionsAndTags(cgsMainConnectionId, 0, spaceIds as CFArray, options.rawValue, &set_tags, &clear_tags) as! [CGWindowID] } static func isSingleSpace() -> Bool { diff --git a/src/logic/Windows.swift b/src/logic/Windows.swift index 65b1c6b7..a7902002 100644 --- a/src/logic/Windows.swift +++ b/src/logic/Windows.swift @@ -6,7 +6,7 @@ class Windows { // the first few thumbnails are the most commonly looked at; we pay special attention to them static let criticalFirstThumbnails = 3 - // reordered list based on preferences, keeping the original index + /// reordered list based on preferences, keeping the original index static func reorderList() { list.sort { if let bool = sortByBooleanAttribute($0.isWindowlessApp, $1.isWindowlessApp) { @@ -158,11 +158,13 @@ class Windows { list.forEachAsync { $0.updatesWindowSpace() } } + /// tabs detection is a flaky work-around the lack of public API to observe OS tabs + /// see: https://github.com/lwouis/alt-tab-macos/issues/1540 static func detectTabbedWindows() { - let cgsWindowIds = Spaces.windowsInSpaces(Spaces.idsAndIndexes.map { $0.0 }, []) + let cgsWindowIds = Spaces.windowsInSpaces(Spaces.idsAndIndexes.map { $0.0 }, [.minimizedAndTabbed]) list.forEach { if let cgWindowId = $0.cgWindowId { - $0.isTabbed = !$0.isMinimized && !$0.isHidden && !cgsWindowIds.contains(cgWindowId) + $0.isTabbed = !cgsWindowIds.contains(cgWindowId) } } }