home: swaylock: notification -> dim screen

This commit is contained in:
Guanran Wang 2024-01-13 16:22:25 +08:00
parent 71a8623821
commit a5ece60862
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8

View file

@ -10,23 +10,23 @@
services.swayidle = let
lock = lib.getExe config.programs.swaylock.package;
displayOn = ''${pkgs.sway}/bin/swaymsg "output * power on"'';
displayOff = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
brightness = lib.getExe pkgs.brightnessctl;
in {
enable = true;
timeouts = [
{
timeout = 60 * 9;
command = ''${lib.getExe pkgs.libnotify} -u critical --expire-time 60000 "60 seconds until lock!"'';
}
command = "${brightness} set $(($(${brightness} get)/4))";
resumeCommand = "${brightness} set $(($(${brightness} get)*4))";
} # dim screen
{
timeout = 60 * 10;
command = lock;
} # lock screen
{
timeout = 60 * 20;
command = displayOff;
resumeCommand = displayOn;
command = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * power on"'';
} # turn off screen
{
timeout = 60 * 30;