Commit 39ecc45e authored by David Edmundson's avatar David Edmundson
Browse files

[systemd] Fix logout issues

It is important that we end plasma-core.target plasma-workspace.target
and graphical-session.target when we log out. graphical-session in turn
closes all other apps and daemons and prevents restarts.
Handling it in systemd gives the least racey option.

graphical-session used to be hanlded in the plasma-ksmserver service
file, but this was removed in 5.24 in a refactor where it caused issues
for Xwayland restarting.

This patch reintroduces the sentinel programs to close down our target,
which in turn take down the other targets. It also removes a complicated
use of templates that in hindsight didn't really solve anything.

BUG: 448492

Testing done:
- logout of wayland shows all targets as inactive, logging in
repeatedly works smoothly
 - logout of X11 behaves the same.
- calling systemctl --user stop plasma-kwin_wayland.service closes the
session
 - killing ksmserver on wayland does not close the session
 - killing ksmserver on X does
parent 7e04bf8f
Pipeline #129160 passed with stage
in 4 minutes and 59 seconds
......@@ -529,7 +529,7 @@ bool useSystemdBoot()
return true;
}
if (!hasSystemdService(QStringLiteral("plasma-workspace@.target"))) {
if (!hasSystemdService(QStringLiteral("plasma-workspace.target"))) {
return false;
}
......@@ -633,7 +633,7 @@ bool startPlasmaSession(bool wayland)
QStringLiteral("/org/freedesktop/systemd1"),
QStringLiteral("org.freedesktop.systemd1.Manager"),
QStringLiteral("StartUnit"));
msg << QStringLiteral("plasma-workspace@%1.target").arg(platform) << QStringLiteral("fail");
msg << QStringLiteral("plasma-workspace-%1.target").arg(platform) << QStringLiteral("fail");
QDBusReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(msg);
if (!reply.isValid()) {
qWarning() << "Could not start systemd managed Plasma session:" << reply.error().name() << reply.error().message();
......
......@@ -2,7 +2,9 @@ ecm_install_configured_files(INPUT plasma-ksplash-ready.service.in @ONLY
DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
install(FILES plasma-core.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
install(FILES plasma-workspace@.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
install(FILES plasma-workspace.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
install(FILES plasma-workspace-wayland.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
install(FILES plasma-workspace-x11.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
add_executable(kde-systemd-start-condition kde-systemd-start-condition.cpp)
target_link_libraries(kde-systemd-start-condition PUBLIC KF5::ConfigCore KF5::Service PlasmaAutostart)
......
......@@ -4,3 +4,4 @@ Wants=plasma-plasmashell.service plasma-kcminit.service plasma-kded.service plas
Requires=plasma-ksmserver.service
After=graphical-session-pre.target plasma-kwin_wayland.service
RefuseManualStart=yes
StopWhenUnneeded=true
[Unit]
Requires=plasma-workspace.target
Requires=plasma-kwin_wayland.service
BindsTo=plasma-kwin_wayland.service
[Unit]
Wants=plasma-kwin_x11.service
Requires=plasma-workspace.target
BindsTo=plasma-ksmserver.service
[Unit]
Description=KDE Plasma Workspace
Requires=plasma-core.target graphical-session.target
Wants=plasma-kwin_%i.service plasma-restoresession.service plasma-xembedsniproxy.service plasma-gmenudbusmenuproxy.service plasma-powerdevil.service plasma-ksplash-ready.service plasma-polkit-agent.service kde-baloo.service plasma-foreground-booster.service plasma-kwallet-pam.service xdg-desktop-autostart.target
Wants=plasma-restoresession.service plasma-xembedsniproxy.service plasma-gmenudbusmenuproxy.service plasma-powerdevil.service plasma-ksplash-ready.service plasma-polkit-agent.service kde-baloo.service plasma-foreground-booster.service plasma-kwallet-pam.service xdg-desktop-autostart.target
BindsTo=graphical-session.target
Before=graphical-session.target xdg-desktop-autostart.target plasma-ksplash-ready.service plasma-restoresession.service
RefuseManualStart=yes
StopWhenUnneeded=true
Supports Markdown
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