From 7b0d17987cdfdbc4cedc3822bf3fd2e4973da452 Mon Sep 17 00:00:00 2001 From: Yaroslav Yashin Date: Wed, 14 May 2025 18:50:54 +0300 Subject: [PATCH] When the application starts with "Start minimized" enabled on macOS (especially the sandboxed App-Store build compiled with MACOS_NE), fully hiding the window prevents it from being restored by clicking the Dock icon. The proper behaviour is to start the window in the *minimized* state instead. That way the window is still part of the window list and the system automatically brings it back when the user clicks the Dock icon, replicating the native experience. On the other platforms we keep the old behaviour (hide the window completely and rely on the tray icon), therefore we switch at runtime by checking the current OS. Closes: QA-7 Closes: QA-8 --- client/ui/controllers/pageController.cpp | 4 +++- client/ui/qml/main2.qml | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/ui/controllers/pageController.cpp b/client/ui/controllers/pageController.cpp index e162f66f..e6bec2e3 100644 --- a/client/ui/controllers/pageController.cpp +++ b/client/ui/controllers/pageController.cpp @@ -132,8 +132,10 @@ void PageController::showOnStartup() } else { #if defined(Q_OS_WIN) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) emit hideMainWindow(); -#elif defined Q_OS_MACX and !defined MACOS_NE +#elif defined Q_OS_MACX && !defined(MACOS_NE) setDockIconVisible(false); +#elif defined(MACOS_NE) + emit hideMainWindow(); #endif } } diff --git a/client/ui/qml/main2.qml b/client/ui/qml/main2.qml index 7cd5790b..85ad700e 100644 --- a/client/ui/qml/main2.qml +++ b/client/ui/qml/main2.qml @@ -69,7 +69,11 @@ Window { } function onHideMainWindow() { - root.hide() + if (Qt.platform.os === "osx") { + root.showMinimized(); + } else { + root.hide(); + } } function onShowErrorMessage(errorMessage) {