diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-12 08:56:39 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-12 08:56:39 +0400 |
| commit | a9fcbf81eb3e5247f699afeee1f078b0dcd93fc3 (patch) | |
| tree | 901374640d5daa46bde1f7ea70d1da4b9e0e6063 | |
| parent | a99f34cba8c34bec71d8c965b0597d95fd0d11b7 (diff) | |
| download | niri-a9fcbf81eb3e5247f699afeee1f078b0dcd93fc3.tar.gz niri-a9fcbf81eb3e5247f699afeee1f078b0dcd93fc3.tar.bz2 niri-a9fcbf81eb3e5247f699afeee1f078b0dcd93fc3.zip | |
Export NIRI_SOCKET to systemd/dbus environment
| -rwxr-xr-x | resources/niri-session | 2 | ||||
| -rw-r--r-- | src/main.rs | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/resources/niri-session b/resources/niri-session index 0ba9af34..fb3121d8 100755 --- a/resources/niri-session +++ b/resources/niri-session @@ -44,4 +44,4 @@ systemctl --user --wait start niri.service 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 +systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP NIRI_SOCKET diff --git a/src/main.rs b/src/main.rs index ed9ac6d4..bcf0feae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -235,12 +235,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { } fn import_env_to_systemd() { + let variables = ["WAYLAND_DISPLAY", niri_ipc::SOCKET_PATH_ENV].join(" "); + let rv = Command::new("/bin/sh") .args([ "-c", - "systemctl --user import-environment WAYLAND_DISPLAY && \ - hash dbus-update-activation-environment 2>/dev/null && \ - dbus-update-activation-environment WAYLAND_DISPLAY", + &format!( + "systemctl --user import-environment {variables} && \ + hash dbus-update-activation-environment 2>/dev/null && \ + dbus-update-activation-environment {variables}" + ), ]) .spawn(); // Wait for the import process to complete, otherwise services will start too fast without |
