diff --git a/modules/graphical/sway/config/config.d/systemd.conf b/modules/graphical/sway/config/config.d/systemd.conf index 66759c4f..9cd8b2b9 100644 --- a/modules/graphical/sway/config/config.d/systemd.conf +++ b/modules/graphical/sway/config/config.d/systemd.conf @@ -5,4 +5,5 @@ # https://github.com/swaywm/sway/wiki/Systemd-integration # Also, import the most important environment variables into the D-Bus and systemd # user environments (e.g. required for screen sharing and Pinentry prompts): -exec "systemctl --user import-environment; systemctl --user start sway-session.target; exec dbus-update-activation-environment --systemd $IMPORT_ENVIRONMENT_ENV_LIST DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemd-cat --identifier=sway sway" +exec "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target; dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP" +exec swaymsg -t subscribe '["shutdown"]' && systemctl --user stop sway-session.target diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index 28570391..ae68ac6b 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -13,7 +13,7 @@ in { # Run when initializing a login shell profileExtra = '' - [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service + [ "$(tty)" = "/dev/tty1" ] && exec systemd-cat --identifier=sway ${pkgs.sway}/bin/sway ''; # Run when initializing an interactive shell diff --git a/modules/user/session-variables.nix b/modules/user/session-variables.nix index 703d939a..f368e7d5 100644 --- a/modules/user/session-variables.nix +++ b/modules/user/session-variables.nix @@ -99,21 +99,11 @@ in BLK + CHR + DIR + EXE + REG + HARDLINK + SYMLINK + MISSING + ORPHAN + FIFO + SOCK + OTHER; }; - - envListNames = lib.attrsets.mapAttrsToList (name: value: name) variables; - - # Here we merge an extra variable into the attrset called FULL_ENV_LIST. - # It's a list of the variable names defined above. - # We can use this to tell `systemctl import-environment` to import the full list above. - variablesWithMeta = lib.attrsets.zipAttrsWith (name: values: builtins.head values) [ - variables - {IMPORT_ENVIRONMENT_ENV_LIST = lib.lists.foldl (a: b: a + " " + b) "IMPORT_ENVIRONMENT_ENV_LIST" envListNames;} - ]; in { - home-manager.users."${psCfg.user.name}" = { - home.sessionVariables = variablesWithMeta; - systemd.user.sessionVariables = variablesWithMeta; - }; + environment.variables = variables; - environment.variables = variablesWithMeta; + home-manager.users."${psCfg.user.name}" = { + home.sessionVariables = variables; + systemd.user.sessionVariables = variables; + }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 36b84381..2bb49d52 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -14,7 +14,6 @@ with prev; { psos-docs = import ./psos-docs.nix final; s = writeShellScriptBin "s" (import ./s.nix final); sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); - sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); swaylock-bg = writeShellScriptBin "swaylock-bg" (import ./swaylock-bg.nix final); toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); diff --git a/pkgs/sway-service.nix b/pkgs/sway-service.nix deleted file mode 100644 index 9ba8bb12..00000000 --- a/pkgs/sway-service.nix +++ /dev/null @@ -1,7 +0,0 @@ -self: -with self; '' - # first import environment variables from the login manager - systemctl --user import-environment; - # then start the service - exec systemctl --wait --user start sway.service -''