diff --git a/src/MainApplicationWindow.qml b/src/MainApplicationWindow.qml index 7707c398997aecac758b9ac95cc76a6fc957552b..c554b2c61585eac3ba3ff50e11bef2240a035214 100644 --- a/src/MainApplicationWindow.qml +++ b/src/MainApplicationWindow.qml @@ -47,10 +47,13 @@ ApplicationWindow { } property ApplicationWindow appWindow : root - property bool isFullScreen: false function toggleFullScreen() { - isFullScreen = !isFullScreen + if (visibility !== Window.FullScreen) { + showFullScreen() + } else { + showNormal() + } } function checkLoadedSource() { @@ -86,11 +89,6 @@ ApplicationWindow { hide() } - visibility: !visible ? - Window.Hidden : (isFullScreen ? - Window.FullScreen : - Window.Windowed) - title: JamiStrings.appTitle width: { @@ -150,6 +148,9 @@ ApplicationWindow { } onLoaded: { + if (UtilsAdapter.getAppValue(Settings.StartMinimized)) { + showMinimized() + } // Quiet check for updates on start if set to. if (UtilsAdapter.getAppValue(Settings.AutoUpdate)) { UpdateManager.checkForUpdates(true) @@ -163,21 +164,16 @@ ApplicationWindow { function onRestoreAppRequested() { requestActivate() - if (isFullScreen) - showFullScreen() - else + if (visibility === Window.Hidden || visibility === Window.Minimized) { showNormal() + } } function onNotificationClicked() { requestActivate() raise() - if (visibility === Window.Hidden || - visibility === Window.Minimized) { - if (isFullScreen) - showFullScreen() - else - showNormal() + if (visibility === Window.Hidden || visibility === Window.Minimized) { + showNormal() } } } diff --git a/src/appsettingsmanager.h b/src/appsettingsmanager.h index 668b1e50d5d199378c3ce03f65cb374f7d59b581..0e4f315f36f9cd29d1ff991782c24f8b6d33401f 100644 --- a/src/appsettingsmanager.h +++ b/src/appsettingsmanager.h @@ -43,6 +43,7 @@ const QString defaultDownloadPath = QStandardPaths::writableLocation( X(DisplayHyperlinkPreviews, true) \ X(EnableDarkTheme, false) \ X(AutoUpdate, true) \ + X(StartMinimized, false) \ X(NeverShowMeAgain, false) /* diff --git a/src/mainapplication.cpp b/src/mainapplication.cpp index 6c98321196fa7521f3fd7ae0b1a9f338703156e3..9e623e2b75d012a416f7ff99099a5aca0d244c0c 100644 --- a/src/mainapplication.cpp +++ b/src/mainapplication.cpp @@ -247,6 +247,9 @@ MainApplication::init() lrcInstance_->accountModel().autoTransferSizeThreshold = acceptTransferBelow; initQmlLayer(); + + settingsManager_->setValue(Settings::Key::StartMinimized, results[opts::STARTMINIMIZED].toBool()); + initSystray(); return true;