36 lines
1.4 KiB
Nix
36 lines
1.4 KiB
Nix
{ inputs, pkgs, ... }:
|
|
|
|
{
|
|
imports = [
|
|
inputs.hypridle.homeManagerModules.default
|
|
];
|
|
|
|
services.hypridle = {
|
|
enable = true;
|
|
lockCmd = "pidof ${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock || ${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock"; # avoid starting multiple hyprlock instances.
|
|
beforeSleepCmd = "${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock"; # lock before suspend.
|
|
afterSleepCmd = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
|
|
|
|
listeners = [
|
|
{
|
|
timeout = 180; # 2.5min.
|
|
onTimeout = "${pkgs.brightnessctl}/bin/brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
|
|
onResume = "${pkgs.brightnessctl}/bin/brightnessctl -r";
|
|
}
|
|
{
|
|
timeout = 300; # 5min
|
|
onTimeout = "${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock";
|
|
}
|
|
{
|
|
timeout = 380; # 5.5min
|
|
onTimeout = "${pkgs.hyprland}/bin/hyprctl dispatch dpms off"; # screen off when timeout has passed
|
|
onResume = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on";
|
|
}
|
|
{
|
|
timeout = 600; # 30min
|
|
onTimeout = "systemctl suspend"; # suspend pc
|
|
}
|
|
];
|
|
};
|
|
}
|