aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-11-25 11:01:23 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-11-25 11:01:23 +0400
commitf085384bc70fb1ac5d19bcb71547b87bb475ee8c (patch)
tree21f7b302c83f00931533b3a303489e3179198efe /resources
parent9eb5d5c22d1c470587c4fad06ed92b753a88d290 (diff)
downloadniri-f085384bc70fb1ac5d19bcb71547b87bb475ee8c.tar.gz
niri-f085384bc70fb1ac5d19bcb71547b87bb475ee8c.tar.bz2
niri-f085384bc70fb1ac5d19bcb71547b87bb475ee8c.zip
Add and call niri-shutdown.target
Sometimes graphical-session.target lingers on after niri quits, leading to services not being started on a quick relogin. To work around this, add and run a systemd target that conflicts with graphical-session.target and forces its shutdown.
Diffstat (limited to 'resources')
-rwxr-xr-xresources/niri-session3
-rw-r--r--resources/niri-shutdown.target7
2 files changed, 10 insertions, 0 deletions
diff --git a/resources/niri-session b/resources/niri-session
index 46d73aa2..0ba9af34 100755
--- a/resources/niri-session
+++ b/resources/niri-session
@@ -40,5 +40,8 @@ fi
# Start niri and wait for it to terminate.
systemctl --user --wait start niri.service
+# Force stop of grahical-session.target.
+systemctl --user start --job-mode=replace-irreversibly niri-shutdown.target
+
# Unset environment that we've set.
systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
diff --git a/resources/niri-shutdown.target b/resources/niri-shutdown.target
new file mode 100644
index 00000000..769ea16f
--- /dev/null
+++ b/resources/niri-shutdown.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Shutdown running niri session
+DefaultDependencies=no
+StopWhenUnneeded=true
+
+Conflicts=graphical-session.target graphical-session-pre.target
+After=graphical-session.target graphical-session-pre.target