From ee436cc7ccba1b1837f79f756d52a56e0eaa87c7 Mon Sep 17 00:00:00 2001 From: lwouis Date: Fri, 21 Nov 2025 23:05:28 +0100 Subject: [PATCH] fix: closing fullscreen window would glitch it (closes #5029) --- src/logic/Window.swift | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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) + } } } }