make hypridle more agnostic

This commit is contained in:
Reid 2024-12-20 07:23:50 -08:00
parent 87d48e27b0
commit 2e94966690
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD

View file

@ -15,9 +15,7 @@ in {
config = mkIf cfg.enable {
hm.home.packages = [ cfg.package ];
hm.services.hypridle = let
hyprctl = "${config.modules.desktop.hyprland.package}/bin/hyprctl";
in {
hm.services.hypridle = {
enable = true;
package = cfg.package;
@ -27,7 +25,6 @@ in {
unlock_cmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session"; # lock the screen before sleeping
after_sleep_cmd = "${hyprctl} dispatch dpms on"; # turn on the screen to avoid moving mouse/pressing key
};
listener = [
@ -41,11 +38,6 @@ in {
on-timeout = "${lib.getExe pkgs.brightnessctl} -d '*:kbd_backlight' -s set 0"; # turn off keyboard backlight, save state
on-resume = "${lib.getExe pkgs.brightnessctl} -d '*:kbd_backlight' -r"; # restore previous keyboard backlight state
}
{
timeout = 90; # 1.5 min
on-timeout = "${hyprctl} dispatch dpms off"; # turn off screen
on-resume = "${hyprctl} dispatch dpms on"; # turn it back on
}
{
timeout = 60 * 2; # 2 min
on-timeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
@ -54,7 +46,13 @@ in {
timeout = 60 * 15; # 15 min
on-timeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
}
];
] ++ optional config.modules.desktop.hyprland.enable (let
hyprctl = "${config.modules.desktop.hyprland.package}/bin/hyprctl";
in {
timeout = 90; # 1.5 min
on-timeout = "${hyprctl} dispatch dpms off"; # turn off screen
on-resume = "${hyprctl} dispatch dpms on"; # turn it back on
});
};
};
};