┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNate Graham <[email protected]>2020-10-29 15:00:39 -0600
committerNate Graham <[email protected]>2020-10-29 15:00:39 -0600
commitbf11c835ebd934d9916327262f23edb25aeb8ab8 (patch)
treea9a89aeeb23852a0614b129483ee70d2db4f0665 /src
parent129570b131bb4c6124aba34022cebba269f3e401 (diff)
Disable session management for daemon
We don't need to autostart the daemon if it was running at logout. BUG: 417219 FIXED-IN: 20.12
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9191127e5..d557f2ea0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,7 @@
#include <QDBusInterface>
#include <QDBusAbstractInterface>
#include <QDBusConnectionInterface>
+#include <QSessionManager>
#ifndef Q_OS_WIN
#include <unistd.h>
@@ -132,6 +133,14 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
if (parser.isSet(QStringLiteral("daemon"))) {
+ // Disable session management for the daemonized version
+ // See https://bugs.kde.org/show_bug.cgi?id=417219
+ auto disableSessionManagement = [](QSessionManager &sm) {
+ sm.setRestartHint(QSessionManager::RestartNever);
+ };
+ QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
+ QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
+
KDBusService dolphinDBusService;
DBusInterface interface;
interface.setAsDaemon();