1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-14 13:01:09 +01:00

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:
oxalica 2022-07-08 01:03:58 +08:00 committed by GitHub
parent 12cfcc1b9d
commit 25a9948361
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 31 additions and 23 deletions

View file

@ -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>
'';
};