diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index f8ad577b..55e9ab03 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -309,7 +309,7 @@ let ) else [ ]) ++ (optional cfg.systemdIntegration '' - exec "systemctl --user import-environment; systemctl --user start sway-session.target"'') + exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target"'') ++ (optional (!cfg.xwayland) "xwayland disable") ++ [ cfg.extraConfig ])); defaultSwayPackage = pkgs.sway.override { @@ -320,7 +320,7 @@ let }; in { - meta.maintainers = with maintainers; [ alexarice sumnerevans sebtm ]; + meta.maintainers = with maintainers; [ alexarice sumnerevans sebtm oxalica ]; options.wayland.windowManager.sway = { enable = mkEnableOption "sway wayland compositor"; @@ -346,6 +346,14 @@ in { Whether to enable sway-session.target on sway startup. This links to graphical-session.target. + Some important environment variables will be imported to systemd + and dbus user environment before reaching the target, including + + DISPLAY + WAYLAND_DISPLAY + SWAYSOCK + XDG_CURRENT_DESKTOP + ''; }; diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index f8e109aa..7f44a2b5 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -106,4 +106,4 @@ bar { } } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix index 9746d050..399790fb 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix @@ -18,7 +18,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-bar-focused-colors.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf index ce9fac65..975bf2a8 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf @@ -103,4 +103,4 @@ bar { } } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix index 5e62748c..0c392925 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix @@ -13,7 +13,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-bindkeys-to-code.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index 82cf254e..0ca82f99 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -103,4 +103,4 @@ bar { } } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-default.nix b/tests/modules/services/window-managers/sway/sway-default.nix index 7bd43731..24796118 100644 --- a/tests/modules/services/window-managers/sway/sway-default.nix +++ b/tests/modules/services/window-managers/sway/sway-default.nix @@ -12,7 +12,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-default.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf index 287e0322..e8afc19d 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -81,4 +81,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf index e6f308c3..bba46942 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -81,4 +81,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix b/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix index ce69d9f7..52aa3cc4 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix @@ -18,7 +18,7 @@ with lib; nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-followmouse-legacy-expected.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-followmouse.nix b/tests/modules/services/window-managers/sway/sway-followmouse.nix index 7065dd1c..788ad218 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse.nix +++ b/tests/modules/services/window-managers/sway/sway-followmouse.nix @@ -16,7 +16,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-followmouse-expected.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index 99e54c84..8753b24a 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -115,4 +115,4 @@ bar { } } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-modules.nix b/tests/modules/services/window-managers/sway/sway-modules.nix index 96366ab0..567f7b5c 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.nix +++ b/tests/modules/services/window-managers/sway/sway-modules.nix @@ -18,7 +18,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-modules.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix index f9111089..44077d44 100644 --- a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix +++ b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -13,7 +13,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${ pkgs.writeText "expected" '' xwayland disable diff --git a/tests/modules/services/window-managers/sway/sway-null-config.nix b/tests/modules/services/window-managers/sway/sway-null-config.nix index 00128c8f..0c0d1e7b 100644 --- a/tests/modules/services/window-managers/sway/sway-null-config.nix +++ b/tests/modules/services/window-managers/sway/sway-null-config.nix @@ -12,7 +12,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${pkgs.writeText "expected" ""} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index 82cf254e..0ca82f99 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -103,4 +103,4 @@ bar { } } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-null-package.nix b/tests/modules/services/window-managers/sway/sway-null-package.nix index fe2a4519..a449b42c 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.nix +++ b/tests/modules/services/window-managers/sway/sway-null-package.nix @@ -21,7 +21,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-null-package.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-post-2003.nix b/tests/modules/services/window-managers/sway/sway-post-2003.nix index 7596250e..72e1fd9e 100644 --- a/tests/modules/services/window-managers/sway/sway-post-2003.nix +++ b/tests/modules/services/window-managers/sway/sway-post-2003.nix @@ -14,7 +14,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-default.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index 233e567d..2f2dd125 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -102,4 +102,4 @@ bar { } } -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default.nix b/tests/modules/services/window-managers/sway/sway-workspace-default.nix index d9411098..6af944eb 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-default.nix @@ -13,7 +13,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-workspace-default-expected.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 683298b6..4ec1e7ce 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -107,4 +107,4 @@ workspace "1" output eDP workspace "ABC" output DP workspace "3: Test" output HDMI workspace "!"§$%&/(){}[]=?\*#<>-_.:,;²³" output DVI -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output.nix b/tests/modules/services/window-managers/sway/sway-workspace-output.nix index ce51c1f5..e096aa1f 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-output.nix @@ -39,7 +39,7 @@ in { nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-workspace-output-expected.conf} ''; }