Commit 8db27170 authored by ivan tkachenko's avatar ivan tkachenko Committed by Nate Graham
Browse files

Prevent session manager from restoring the app on start up

It can be quite frustrating to see Spectacle starting up during first
frames of Plasma desktop initialization and immediately taking a
screenshot of a splash screen.

BUG: 430411
parent 46e90679
......@@ -18,6 +18,7 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QDBusConnection>
#include <QSessionManager>
#include <KAboutData>
#include <KDBusService>
......@@ -57,6 +58,14 @@ int main(int argc, char **argv)
lCmdLineParser.process(app.arguments());
aboutData.processCommandLine(&lCmdLineParser);
QGuiApplication::setFallbackSessionManagementEnabled(false);
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
// and new-instance
if (lCmdLineParser.isSet(QStringLiteral("new-instance"))) {
lCore.init();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment