diff --git a/modules/users.nix b/modules/users.nix index 62d6dec..cce5199 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -37,17 +37,9 @@ "/run/user/1000"; services.udev.extraRules = '' - ACTION=="remove", ATTRS{idVendor}=="1050", RUN+="${pkgs.systemd}/bin/systemctl start swaylock" + ACTION=="remove", ATTRS{idVendor}=="1050", RUN+="${pkgs.systemd}/bin/loginctl lock-sessions" ''; - systemd.services.swaylock = { - description = "Lock the screen"; - serviceConfig.User = "balsoft"; - environment.XDG_RUNTIME_DIR = "/run/user/1000"; - path = [pkgs.swaylock]; - script = "swaylock -c ${builtins.substring 1 7 config.themes.colors.bg}"; - }; - security.pam.u2f = { control = "sufficient"; cue = true; diff --git a/modules/workspace/i3/default.nix b/modules/workspace/i3/default.nix index 3430759..b88e506 100755 --- a/modules/workspace/i3/default.nix +++ b/modules/workspace/i3/default.nix @@ -2,6 +2,7 @@ let thm = config.themes.colors; apps = config.defaultApplications; + lock = "swaylock -c ${builtins.substring 1 7 thm.bg}"; in { environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1"; @@ -85,7 +86,7 @@ in { { command = "${pkgs.cantata}/bin/cantata"; } { - command = "swayidle -w before-sleep 'swaylock -f -c ${builtins.substring 1 7 thm.bg}'"; + command = "swayidle before-sleep '${lock}' lock '${lock}' unlock 'pkill -9 swaylock'"; } ]; @@ -161,9 +162,9 @@ in { "${modifier}+v" = "split v"; "${modifier}+F1" = "move to scratchpad"; "${modifier}+F2" = "scratchpad show"; - "${modifier}+F11" = "exec swaylock -f -c ${builtins.substring 1 7 thm.bg}; output * dpms off"; + "${modifier}+F11" = "exec ${lock}; output * dpms off"; "${modifier}+F12" = "output * dpms on"; - "${modifier}+End" = "exec swaylock -f -c ${builtins.substring 1 7 thm.bg}"; + "${modifier}+End" = "exec ${lock}"; "${modifier}+p" = "sticky toggle"; "${modifier}+i" = script "0x0" ''wl-paste | curl -F"file=@-" https://0x0.st | wl-copy'';