From 8962ad1a5432fd2edf0b324d5897b0fb438caadb Mon Sep 17 00:00:00 2001 From: lwouis Date: Mon, 16 Mar 2026 19:44:17 +0100 Subject: [PATCH] fix: apps with no open window might not show up (closes #5424) --- src/logic/Application.swift | 6 +++++- src/logic/Applications.swift | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/logic/Application.swift b/src/logic/Application.swift index d5c4eeec..6f9776fe 100644 --- a/src/logic/Application.swift +++ b/src/logic/Application.swift @@ -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) } } } diff --git a/src/logic/Applications.swift b/src/logic/Applications.swift index 6112df8e..fe04cf5c 100644 --- a/src/logic/Applications.swift +++ b/src/logic/Applications.swift @@ -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