Export NIRI_SOCKET to systemd/dbus environment
Browse files at this commita9fcbf81eb3e5247f699afeee1f078b0dcd93fc3Parent: a99f34c2 changed files +8 -4
- resources/niri-session +1 -1
- src/main.rs +7 -3
resources/niri-sessionmodified+1 -1
| @@ -44,4 +44,4 @@ systemctl --user --wait start niri.service | |||
| 44 | systemctl --user start --job-mode=replace-irreversibly niri-shutdown.target | 44 | systemctl --user start --job-mode=replace-irreversibly niri-shutdown.target |
| 45 | 45 | ||
| 46 | # Unset environment that we've set. | 46 | # Unset environment that we've set. |
| 47 | -systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP | 47 | +systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP NIRI_SOCKET |
src/main.rsmodified+7 -3
| @@ -235,12 +235,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | |||
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | fn import_env_to_systemd() { | 237 | fn import_env_to_systemd() { |
| 238 | + let variables = ["WAYLAND_DISPLAY", niri_ipc::SOCKET_PATH_ENV].join(" "); | ||
| 239 | + | ||
| 238 | let rv = Command::new("/bin/sh") | 240 | let rv = Command::new("/bin/sh") |
| 239 | .args([ | 241 | .args([ |
| 240 | "-c", | 242 | "-c", |
| 241 | - "systemctl --user import-environment WAYLAND_DISPLAY && \ | 243 | + &format!( |
| 242 | - hash dbus-update-activation-environment 2>/dev/null && \ | 244 | + "systemctl --user import-environment {variables} && \ |
| 243 | - dbus-update-activation-environment WAYLAND_DISPLAY", | 245 | + hash dbus-update-activation-environment 2>/dev/null && \ |
| 246 | + dbus-update-activation-environment {variables}" | ||
| 247 | + ), | ||
| 244 | ]) | 248 | ]) |
| 245 | .spawn(); | 249 | .spawn(); |
| 246 | // Wait for the import process to complete, otherwise services will start too fast without | 250 | // Wait for the import process to complete, otherwise services will start too fast without |