fix: tabs show as separate windows sometimes on monterey (closes #2017)

This commit is contained in:
decodism authored and Louis Pontoise committed 2022-11-03 11:16:51 +01:00
1 parent fe38b53ff7
commit 0965a78d46
2 files changed
+6 -4

No files matched your search

+1 -1
View File
@@ -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 {
+5 -3
View File
@@ -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)
}
}
}