fix: finder would sometimes not be listed (closes #3350)

This commit is contained in:
lwouis
2024-08-31 18:01:32 +02:00
parent 0e6f200efe
commit eba5e422bf
+4 -1
View File
@@ -63,6 +63,7 @@ class Application: NSObject {
// TODO: this method manually checks windows, but will not find windows on other Spaces
retryAxCallUntilTimeout(group, 5) { [weak self] in
guard let self = self else { return }
var atLeastOneActualWindow = false
if let axWindows_ = try self.axUiElement!.windows(), axWindows_.count > 0 {
// bug in macOS: sometimes the OS returns multiple duplicate windows (e.g. Mail.app starting at login)
try Array(Set(axWindows_)).forEach { axWindow in
@@ -76,6 +77,7 @@ class Application: NSObject {
let isFullscreen = try axWindow.isFullscreen()
let isMinimized = try axWindow.isMinimized()
let position = try axWindow.position()
atLeastOneActualWindow = true
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
if let window = (Windows.list.first { $0.isEqualRobust(axWindow, wid) }) {
@@ -92,7 +94,8 @@ class Application: NSObject {
}
}
}
} else {
}
if (!atLeastOneActualWindow) {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
let window = self.addWindowslessAppsIfNeeded()