diff --git a/home-manager/sway/default.nix b/home-manager/sway/default.nix index af0bcf2..a5526f9 100644 --- a/home-manager/sway/default.nix +++ b/home-manager/sway/default.nix @@ -2,6 +2,8 @@ let font.name = "DejaVu Sans Mono"; font.size = 12.0; + lock_command = "${pkgs.swaylock-fancy}/bin/swaylock-fancy --daemonize --show-failed-attempts --ignore-empty-password"; + swaymsg = "${pkgs.sway}/bin/swaymsg"; in { imports = [ @@ -39,6 +41,17 @@ in }; }; + services.swayidle = { + enable = true; + events = [ + { event = "before-sleep"; command = lock_command; } + ]; + timeouts = [ + { timeout = 300; command = "${swaymsg} output '*' power off"; resumeCommand = "${swaymsg} output '*' power on"; } + { timeout = 900; command = lock_command; } + ]; + }; + wayland.windowManager.sway = { enable = true; @@ -90,7 +103,7 @@ in in lib.mkOptionDefault { "${modifier}+Shift+o" = "exec xdg-open \"zoommtg://zoom.us/join?action=join&confno=4861587170&pwd=ZVk3aHphcWppY21ONjZOMVh6STN6dz09\""; - "${modifier}+l" = "exec swaylock-fancy"; + "${modifier}+l" = "exec ${lock_command}"; }; assigns = {