From e1b146551a0623a308f09a2d9be417b9cf7a4e83 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 7 Jun 2022 14:12:03 +0200 Subject: [PATCH] startkde: Reload systemd on Plasma start If the time between logout and relogin is short enough or a separate session is open during that time, the systemd user instance keeps running. This means that generators like the one for XDG autostart handling aren't run again, which effectively means it's still using the configuration from the previous session. Just reload systemd on every login to make sure its state is fresh. --- startkde/startplasma.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index dc928a62d..9f026e033 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -504,6 +504,17 @@ void resetSystemdFailedUnits() QDBusConnection::sessionBus().call(message); } +// Reload systemd to make sure the current configuration is active, which also reruns generators. +// Needed for e.g. XDG autostart changes to become effective. +void reloadSystemd() +{ + QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"), + QStringLiteral("/org/freedesktop/systemd1"), + QStringLiteral("org.freedesktop.systemd1.Manager"), + QStringLiteral("Reload")); + QDBusConnection::sessionBus().call(message); +} + bool hasSystemdService(const QString &serviceName) { qDBusRegisterMetaType>(); @@ -611,6 +622,7 @@ static void migrateUserScriptsAutostart() bool startPlasmaSession(bool wayland) { resetSystemdFailedUnits(); + reloadSystemd(); OrgKdeKSplashInterface iface(QStringLiteral("org.kde.KSplash"), QStringLiteral("/KSplash"), QDBusConnection::sessionBus()); iface.setStage(QStringLiteral("startPlasma")); // finally, give the session control to the session manager