From 126a5be9a7bd45cfec2642e6fcfb1beac8dcf5b5 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 4 Aug 2026 15:57:21 -0400 Subject: [PATCH] fix(windows): maximize app back to the screen it was before Fixes #20157 --- ui/main.qml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/main.qml b/ui/main.qml index ca9be9babd..14e48f5ab0 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -188,9 +188,19 @@ Window { readonly property bool macOSWindowed: SQUtils.Utils.isMacOS && applicationWindow.visibility !== Window.FullScreen + function restoreScreenAfterMinimizing() { + if (Qt.platform.os !== SQUtils.Utils.windows || !lastMinimizedScreen) + return + + if (Qt.application.screens.includes(lastMinimizedScreen)) + applicationWindow.screen = lastMinimizedScreen + lastMinimizedScreen = null + } + function restoreWindowState() { if (SQUtils.Utils.isMobile) // no point in restoring window state return + restoreScreenAfterMinimizing() switch(lastNonMinVisibility) { case Window.Windowed: applicationWindow.showNormal() @@ -205,6 +215,7 @@ Window { } property int lastNonMinVisibility + property var lastMinimizedScreen: null property bool showSkippedBiometricFlow: false @@ -334,8 +345,13 @@ Window { Connections { target: applicationWindow function onVisibilityChanged(visibility) { + if (visibility === Window.Minimized) { + d.lastMinimizedScreen = applicationWindow.screen + return + } if (applicationWindow.visibility !== Window.Minimized && applicationWindow.visibility !== Window.Hidden) { + d.restoreScreenAfterMinimizing() d.lastNonMinVisibility = applicationWindow.visibility } }