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 = [
84 { source = "resources/niri.desktop", dest = "/usr/share/wayland-sessions/", mode = "644" },84 { source = "resources/niri.desktop", dest = "/usr/share/wayland-sessions/", mode = "644" },
85 { source = "resources/niri-portals.conf", dest = "/usr/share/xdg-desktop-portal/", mode = "644" },85 { source = "resources/niri-portals.conf", dest = "/usr/share/xdg-desktop-portal/", mode = "644" },
86 { source = "resources/niri.service", dest = "/usr/lib/systemd/user/", mode = "644" },86 { source = "resources/niri.service", dest = "/usr/lib/systemd/user/", mode = "644" },
87+ { source = "resources/niri-shutdown.target", dest = "/usr/lib/systemd/user/", mode = "644" },
87 ]88 ]
88 [package.metadata.generate-rpm.requires]89 [package.metadata.generate-rpm.requires]
89 alacritty = "*"90 alacritty = "*"
README.mdmodified+1 -0
@@ -64,6 +64,7 @@ To do that, put files into the correct directories according to this table.
64 | `resources/niri.desktop` | `/usr/share/wayland-sessions/` |64 | `resources/niri.desktop` | `/usr/share/wayland-sessions/` |
65 | `resources/niri-portals.conf` | `/usr/share/xdg-desktop-portal/` |65 | `resources/niri-portals.conf` | `/usr/share/xdg-desktop-portal/` |
66 | `resources/niri.service` | `/usr/lib/systemd/user/` |66 | `resources/niri.service` | `/usr/lib/systemd/user/` |
67+| `resources/niri-shutdown.target` | `/usr/lib/systemd/user/` |
67 68
68 Doing this will make niri appear in GDM and, presumably, other display managers.69 Doing this will make niri appear in GDM and, presumably, other display managers.
69 70
resources/niri-sessionmodified+3 -0
@@ -40,5 +40,8 @@ fi
40 # Start niri and wait for it to terminate.40 # Start niri and wait for it to terminate.
41 systemctl --user --wait start niri.service41 systemctl --user --wait start niri.service
42 42
43+# Force stop of grahical-session.target.
44+systemctl --user start --job-mode=replace-irreversibly niri-shutdown.target
45+
43 # Unset environment that we've set.46 # Unset environment that we've set.
44 systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP47 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