diff --git a/src/logic/Window.swift b/src/logic/Window.swift index 2a3e0eea..eca65f60 100644 --- a/src/logic/Window.swift +++ b/src/logic/Window.swift @@ -121,9 +121,17 @@ class Window { guard let self else { return } if self.isFullscreen { try? self.axUiElement!.setAttribute(kAXFullscreenAttribute, false) - } - if let closeButton_ = try? self.axUiElement!.closeButton() { - try? closeButton_.performAction(kAXPressAction) + // minimizing is ignored if sent immediatly; we wait for the de-fullscreen animation to be over + BackgroundWork.accessibilityCommandsQueue.addOperationAfter(deadline: .now() + .seconds(1)) { [weak self] in + guard let self else { return } + if let closeButton_ = try? self.axUiElement!.closeButton() { + try? closeButton_.performAction(kAXPressAction) + } + } + } else { + if let closeButton_ = try? self.axUiElement!.closeButton() { + try? closeButton_.performAction(kAXPressAction) + } } } }