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