forge
Explore
Log in

Don't you dare go Hollow

Add and call niri-shutdown.target

Browse files at this commit

f085384bc70fb1ac5d19bcb71547b87bb475ee8cIvan MolodetskikhParent: 9eb5d5c
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.
Cargo.tomlmodified+1 -0
@@ -84,6 +84,7 @@ assets = [
8484 { source = "resources/niri.desktop", dest = "/usr/share/wayland-sessions/", mode = "644" },
8585 { source = "resources/niri-portals.conf", dest = "/usr/share/xdg-desktop-portal/", mode = "644" },
8686 { source = "resources/niri.service", dest = "/usr/lib/systemd/user/", mode = "644" },
87+ { source = "resources/niri-shutdown.target", dest = "/usr/lib/systemd/user/", mode = "644" },
8788 ]
8889 [package.metadata.generate-rpm.requires]
8990 alacritty = "*"
README.mdmodified+1 -0
@@ -64,6 +64,7 @@ To do that, put files into the correct directories according to this table.
6464 | `resources/niri.desktop` | `/usr/share/wayland-sessions/` |
6565 | `resources/niri-portals.conf` | `/usr/share/xdg-desktop-portal/` |
6666 | `resources/niri.service` | `/usr/lib/systemd/user/` |
67+| `resources/niri-shutdown.target` | `/usr/lib/systemd/user/` |
6768
6869 Doing this will make niri appear in GDM and, presumably, other display managers.
6970
resources/niri-sessionmodified+3 -0
@@ -40,5 +40,8 @@ fi
4040 # Start niri and wait for it to terminate.
4141 systemctl --user --wait start niri.service
4242
43+# Force stop of grahical-session.target.
44+systemctl --user start --job-mode=replace-irreversibly niri-shutdown.target
45+
4346 # Unset environment that we've set.
4447 systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
resources/niri-shutdown.targetadded+7 -0
@@ -0,0 +1,7 @@
1+[Unit]
2+Description=Shutdown running niri session
3+DefaultDependencies=no
4+StopWhenUnneeded=true
5+
6+Conflicts=graphical-session.target graphical-session-pre.target
7+After=graphical-session.target graphical-session-pre.target