From 07d4c10d8cf66cb0b170ff3b581135eabc7efb66 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 2 Oct 2021 09:18:12 +0300 Subject: [PATCH] prevent session manager from restoring application --disable session manager restoring and keep only the autostart desktop file way in order to start Latte --- app/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/main.cpp b/app/main.cpp index 3c4bbf165..89b630e30 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include // KDE @@ -186,6 +187,19 @@ int main(int argc, char **argv) return 0; } + //! disable restore from session management + //! based on spectacle solution at: + //! - https://bugs.kde.org/show_bug.cgi?id=430411 + //! - https://invent.kde.org/graphics/spectacle/-/commit/8db27170d63f8a4aaff09615e51e3cc0fb115c4d + QGuiApplication::setFallbackSessionManagementEnabled(false); + + auto disableSessionManagement = [](QSessionManager &sm) { + sm.setRestartHint(QSessionManager::RestartNever); + }; + QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement); + QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement); + + //! choose layout for startup bool defaultLayoutOnStartup = false; int memoryUsage = -1; QString layoutNameOnStartup = "";