fix: apps with no open window might not show up (closes #5424)

This commit is contained in:
lwouis
2026-03-16 19:44:17 +01:00
parent 39b818de11
commit 8962ad1a54
2 changed files with 5 additions and 7 deletions
+5 -1
View File
@@ -146,7 +146,11 @@ class Application: NSObject {
// apps don't always create kAXApplicationActivatedNotification upon launch; we update frontmostPid in case it has changed
Applications.frontmostPid = NSWorkspace.shared.frontmostApplication?.processIdentifier
// apps don't always send kAXWindowCreatedNotification upon launch; we manually check to prevent missing windows
if let self { Applications.manuallyUpdateWindows(self) }
guard let self else { return }
if addWindowlessWindowIfNeeded() != nil {
App.refreshOpenUiAfterExternalEvent([])
}
Applications.manuallyUpdateWindows(self)
}
}
}
-6
View File
@@ -40,12 +40,6 @@ class Applications {
guard let app, let axUiElement = app.axUiElement else { return }
let axWindows = try axUiElement.allWindows(app.pid)
guard !axWindows.isEmpty else {
DispatchQueue.main.async { [weak app] in
guard let app else { return }
if app.addWindowlessWindowIfNeeded() != nil {
App.refreshOpenUiAfterExternalEvent([])
}
}
// workaround: some apps launch but take a while to create their window(s)
// initial windows don't trigger a windowCreated notification, so we won't get notified
// it's very unlikely an app would launch with no initial window