From 19cf628a936dfb54d5902e4e0b61be0afd938f8e 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. (cherry picked from commit e1b146551a0623a308f09a2d9be417b9cf7a4e83) --- startkde/startplasma.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index bc5e278fa..f43ea3ae1 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -505,6 +505,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>(); @@ -612,6 +623,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