sway: import dbus env vars and explicitly specify them (#3031)
- Importing all environment variables is considered deprecated for `systemdctl import-environment`. The list of variables are picked from: https://github.com/swaywm/sway/wiki/Systemd-integration#managing-user-applications-with-systemd The `XDG_CURRENT_DESKTOP` is said to be required for portals, see: https://github.com/nix-community/home-manager/pull/2385#issuecomment-1026454162 - DBus activation environment should also be updated. Otherwise, DBus activated programs, without a coresponding systemd service, cannot get a correct environment and would fail, eg. `mako`.
This commit is contained in:
parent
12cfcc1b9d
commit
25a9948361
|
@ -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 <filename>sway-session.target</filename> on
|
||||
sway startup. This links to
|
||||
<filename>graphical-session.target</filename>.
|
||||
Some important environment variables will be imported to systemd
|
||||
and dbus user environment before reaching the target, including
|
||||
<itemizedlist>
|
||||
<listitem><para><literal>DISPLAY</literal></para></listitem>
|
||||
<listitem><para><literal>WAYLAND_DISPLAY</literal></para></listitem>
|
||||
<listitem><para><literal>SWAYSOCK</literal></para></listitem>
|
||||
<listitem><para><literal>XDG_CURRENT_DESKTOP</literal></para></listitem>
|
||||
</itemizedlist>
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" ""}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue