Better lockscreen automation + sddm theme

This commit is contained in:
Filippo Berto 2022-08-17 21:20:43 +02:00
parent 613673299d
commit 0a07445ebc
10 changed files with 62 additions and 17 deletions

View file

@ -5,18 +5,30 @@ with lib;
let
xbacklightCmd = "${pkgs.xorg.xbacklight}/bin/xbacklight";
lightLevel = 10;
package = pkgs.writeScriptBin "xidlehook" ''
${pkgs.xidlehook}/bin/xidlehook --detect-sleep "$@"
'';
saveLightLevel = "${xbacklightCmd} -get > /run/user/$UID/xbacklight_v";
lowerLight = "${xbacklightCmd} -set ${toString lightLevel}";
resetLight = "${xbacklightCmd} -set $(</run/user/$UID/xbacklight_v) || ${xbacklightCmd} -set 100";
in
{
services.xidlehook = {
inherit package;
enable = true;
not-when-audio = true;
# not-when-audio = true;
not-when-fullscreen = true;
timers = [
{
command = "${xbacklightCmd} -get > /tmp/xbacklight_v && ${xbacklightCmd} -set ${toString lightLevel}";
canceller = "${xbacklightCmd} -set $(cat /tmp/xbacklight_v || echo 100)";
command = "${saveLightLevel} && ${lowerLight}";
canceller = resetLight;
delay = 60;
}
{
command = "${pkgs.lockscreen}/bin/lockscreen";
canceller = resetLight;
delay = 120;
}
];
};
}