home: configure swayidle

This commit is contained in:
Guanran Wang 2023-11-05 15:24:13 +08:00
parent a5e6e42ee9
commit a35384e8f3
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
2 changed files with 27 additions and 1 deletions

View file

@ -250,9 +250,34 @@
# }; # };
#}; #};
services = { services = {
udiskie.enable = true; udiskie.enable = true;
swayidle = let
lockCommand = "${pkgs.swaylock-effects}/bin/swaylock --screenshots --clock --indicator --line-color cdd6f4ff --text-color cdd6f4ff --inside-color 1e1e2eff --ring-color 313244ff --line-ver-color cdd6f4ff --text-ver-color cdd6f4ff --inside-ver-color 1e1e2eff --ring-ver-color 313244ff --line-clear-color cdd6f4ff --text-clear-color cdd6f4ff --inside-clear-color 1e1e2eff --ring-clear-color 313244ff --line-clear-color cdd6f4ff --text-wrong-color 313244ff --inside-wrong-color f38ba8ff --ring-wrong-color 313244ff --key-hl-color cba6f7ff --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2";
in {
enable = true;
timeouts = [
{
timeout = 900;
command = "loginctl lock-session";
}
{
timeout = 905;
command = ''${pkgs.sway}/bin/swaymsg "output * dpms off"'';
resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * dpms on"'';
} # turn off screen
];
events = [
{
event = "lock";
command = lockCommand;
} # loginctl lock-session
{
event = "before-sleep";
command = lockCommand;
} # systemctl syspend
];
};
}; };
programs = { programs = {

View file

@ -10,4 +10,5 @@
### home-manager ### home-manager
home-manager.users.guanranwang = import ../../home-manager/nixos/presets/desktop.nix; home-manager.users.guanranwang = import ../../home-manager/nixos/presets/desktop.nix;
fonts.enableDefaultPackages = false; fonts.enableDefaultPackages = false;
security.pam.services.swaylock = {};
} }