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 e1b146551a)
wilder-5.25
Fabian Vogt 4 years ago
parent a8a76170a5
commit 19cf628a93
  1. 12
      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<QPair<QString, QString>>();
@ -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

Loading…
Cancel
Save