diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index ecd7bb53..72995908 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -311,10 +311,10 @@ let )} '' else - "") + "\n" + (if cfg.systemdIntegration then '' - exec "systemctl --user import-environment; systemctl --user start sway-session.target" - '' else - "") + cfg.extraConfig); + "") + (concatStringsSep "\n" ((optional cfg.systemdIntegration '' + exec "systemctl --user import-environment; systemctl --user start sway-session.target"'') + ++ (optional (!cfg.xwayland) "xwayland disable") + ++ [ cfg.extraConfig ]))); defaultSwayPackage = pkgs.sway.override { extraSessionCommands = cfg.extraSessionCommands; diff --git a/tests/modules/services/window-managers/sway/default.nix b/tests/modules/services/window-managers/sway/default.nix index 6ad673b1..7cc948ca 100644 --- a/tests/modules/services/window-managers/sway/default.nix +++ b/tests/modules/services/window-managers/sway/default.nix @@ -5,6 +5,7 @@ sway-followmouse = ./sway-followmouse.nix; sway-followmouse-legacy = ./sway-followmouse-legacy.nix; sway-modules = ./sway-modules.nix; + sway-no-xwayland = ./sway-no-xwayland.nix; sway-null-config = ./sway-null-config.nix; sway-null-package = ./sway-null-package.nix; sway-post-2003 = ./sway-post-2003.nix; 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 558e579a..d55c9200 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 @@ -110,5 +110,4 @@ bar { } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" 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 7879ceab..97c72710 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 @@ -110,5 +110,4 @@ bar { } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index 1cd75fd5..6ef61a7a 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -110,5 +110,4 @@ bar { } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" 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 4eae3679..7fa4da07 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -83,5 +83,4 @@ bindsym k resize shrink height 10 px bindsym l resize grow width 10 px } - exec "systemctl --user import-environment; 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 c6497eb6..c470a7c4 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 @@ -83,5 +83,4 @@ bindsym k resize shrink height 10 px bindsym l resize grow width 10 px } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index 1cec60e8..c0339d71 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -122,5 +122,4 @@ bar { } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix new file mode 100644 index 00000000..f19b88eb --- /dev/null +++ b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./sway-stubs.nix ]; + + wayland.windowManager.sway = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + config = null; + systemdIntegration = false; + xwayland = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/sway/config + assertFileContent 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 4033903d..00128c8f 100644 --- a/tests/modules/services/window-managers/sway/sway-null-config.nix +++ b/tests/modules/services/window-managers/sway/sway-null-config.nix @@ -13,6 +13,6 @@ nmt.script = '' assertFileExists home-files/.config/sway/config assertFileContent home-files/.config/sway/config \ - ${pkgs.writeText "expected" "\n"} + ${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 1cd75fd5..6ef61a7a 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -110,5 +110,4 @@ bar { } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" 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 7aa1e1e4..b5c92fa6 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 @@ -109,5 +109,4 @@ bar { } - exec "systemctl --user import-environment; systemctl --user start sway-session.target" 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 e4a4f6cf..bacb27f8 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 @@ -114,5 +114,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"