fix: show windows of some defective apps like bear.app

This commit is contained in:
metacodes authored and Louis Pontoise committed 2022-04-07 21:05:19 +09:00
1 parent 0b85b09f62
commit 9b5cd427e6
1 file changed
+8 -2
+8 -2
View File
@@ -113,8 +113,14 @@ class Application: NSObject {
let window = self.addWindowslessAppsIfNeeded()
App.app.refreshOpenUi(window)
}
// workaround: opening an app while the active app is fullscreen; we wait out the space transition animation
if group == nil && !self.wasLaunchedBeforeAltTab && CGSSpaceGetType(cgsMainConnectionId, Spaces.currentSpaceId) == .fullscreen {
if group == nil && !self.wasLaunchedBeforeAltTab && (
// workaround: opening an app while the active app is fullscreen; we wait out the space transition animation
CGSSpaceGetType(cgsMainConnectionId, Spaces.currentSpaceId) == .fullscreen ||
// workaround: some apps launch but have no window ready instantly. It's very unlikely an app would launch with no window
// so we retry until timeout, in those rare cases (e.g. Bear.app)
// we only do this for active app, to avoid wasting CPU, with the trade-off of maybe missing some windows
self.runningApplication.isActive
) {
throw AxError.runtimeError
}
}