diff --git a/modules/users.nix b/modules/users.nix index b19c677..2f27e6b 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -24,18 +24,22 @@ uid = 1000; password = ""; }; - - - systemd.services."user@" = { - serviceConfig = { - Restart = "always"; - }; - }; - - home-manager.users.balsoft.xdg.configFile."Yubico/u2f_keys".text = "balsoft:CicONGIHB4jL1NuHA36oPlPn5qsAQgIjQKGTSC3F-XZEAWdRVBX0jr8I_PxbgQR6Ys1toFJhaXtqYjY__uVhgg,04f580832926c646e918123bd516851ac5bf7d54482c1e2eb05e0e3f6aae197e4fc4853a2760794cf597001498f1833b3d36015cafa5f61703f3fbf59b73e05eca"; - home-manager.users.balsoft.home.sessionVariables.XDG_RUNTIME_DIR = "/run/user/1000"; + systemd.services."user@" = { serviceConfig = { Restart = "always"; }; }; + home-manager.users.balsoft.xdg.configFile."Yubico/u2f_keys".text = + "balsoft:CicONGIHB4jL1NuHA36oPlPn5qsAQgIjQKGTSC3F-XZEAWdRVBX0jr8I_PxbgQR6Ys1toFJhaXtqYjY__uVhgg,04f580832926c646e918123bd516851ac5bf7d54482c1e2eb05e0e3f6aae197e4fc4853a2760794cf597001498f1833b3d36015cafa5f61703f3fbf59b73e05eca"; + + home-manager.users.balsoft.home.sessionVariables.XDG_RUNTIME_DIR = + "/run/user/1000"; + + services.udev.extraRules = '' + ACTION=="remove", ATTRS{idVendor}=="1050, RUN+="${ + pkgs.writeShellScript "lock-system" + "/run/wrappers/bin/sudo -u balsoft 'swaylock -f -c ${ + builtins.substring 1 7 config.themes.colors.bg + }'" + }"''; security.pam.u2f = { control = "required"; cue = true; @@ -44,7 +48,6 @@ security.sudo = { enable = true; extraConfig = '' - balsoft ALL = (root) NOPASSWD: /run/current-system/sw/bin/nixos-rebuild switch balsoft ALL = (root) NOPASSWD: ${pkgs.light}/bin/light -A 5 balsoft ALL = (root) NOPASSWD: ${pkgs.light}/bin/light -U 5 ''; diff --git a/modules/workspace/i3/default.nix b/modules/workspace/i3/default.nix index de8a7c3..d7cfbce 100755 --- a/modules/workspace/i3/default.nix +++ b/modules/workspace/i3/default.nix @@ -88,7 +88,9 @@ in { { command = "${pkgs.cantata}/bin/cantata"; } - + { + command = "swayidle -w before-sleep 'swaylock -f -c ${builtins.substring 1 7 thm.bg}'"; + } ]; keybindings = let @@ -163,7 +165,7 @@ in { "${modifier}+v" = "split v"; "${modifier}+F1" = "move to scratchpad"; "${modifier}+F2" = "scratchpad show"; - "${modifier}+F11" = "output * dpms off"; + "${modifier}+F11" = "--locked exec 'swaylock -f -c ${builtins.substring 1 7 thm.bg}'; output * dpms off"; "${modifier}+F12" = "output * dpms on"; "${modifier}+p" = "sticky toggle"; "${modifier}+i" =