Move modules folders

This commit is contained in:
Filippo Berto 2025-09-11 14:00:31 +02:00
parent 914909009c
commit c1101e7b45
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
183 changed files with 327 additions and 327 deletions

46
hm/xidlehook.nix Normal file
View file

@ -0,0 +1,46 @@
{ pkgs, ... }:
let
xbacklightCmd = "${pkgs.xorg.xbacklight}/bin/xbacklight";
xsetCmd = "${pkgs.xorg.xset}/bin/xset";
lightLevel = 10;
saveLightLevel = pkgs.writeShellScript "saveLightLevel" ''
${xbacklightCmd} -get > /run/user/$UID/xbacklight_v
'';
lowerLight = pkgs.writeShellScript "lower_light" ''
${xbacklightCmd} -set ${toString lightLevel}
'';
resetLight = pkgs.writeShellScript "reset_light" ''
${xbacklightCmd} -set $(</run/user/$UID/xbacklight_v) || ${xbacklightCmd} -set 100
'';
shutDownScreens = pkgs.writeShellScript "shutdown_screens" ''
${xsetCmd} dpms force off
'';
in
{
services.xidlehook = {
enable = true;
package = pkgs.writeScriptBin "xidlehook" ''
${pkgs.xidlehook}/bin/xidlehook --detect-sleep "$@"
'';
# not-when-audio = true;
not-when-fullscreen = true;
timers = [
{
command = "${saveLightLevel} && ${lowerLight}";
canceller = "${resetLight}";
delay = 60;
}
{
command = "${pkgs.lockscreen}/bin/lockscreen";
canceller = "${resetLight}";
delay = 120;
}
{
command = "${shutDownScreens}";
canceller = "${resetLight}";
delay = 300;
}
];
};
}