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 services.swayidle = let
lock = lib.getExe config.programs.swaylock.package; lock = lib.getExe config.programs.swaylock.package;
displayOn = ''${pkgs.sway}/bin/swaymsg "output * power on"''; brightness = lib.getExe pkgs.brightnessctl;
displayOff = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
in { in {
enable = true; enable = true;
timeouts = [ timeouts = [
{ {
timeout = 60 * 9; 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; timeout = 60 * 10;
command = lock; command = lock;
} # lock screen } # lock screen
{ {
timeout = 60 * 20; timeout = 60 * 20;
command = displayOff; command = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
resumeCommand = displayOn; resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * power on"'';
} # turn off screen } # turn off screen
{ {
timeout = 60 * 30; timeout = 60 * 30;