feat: don't start sway as a systemd service

This commit is contained in:
teutat3s 2024-03-06 18:42:25 +01:00
parent b0aa120073
commit fa7812b21f
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
5 changed files with 8 additions and 25 deletions

View file

@ -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

View file

@ -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

View file

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

View file

@ -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);

View file

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