nixos/home/system/hypridle/default.nix
dim 4c874e960d
All checks were successful
/ update-readme (push) Successful in 50s
starting dbrw config
2024-12-30 11:27:00 +07:00

44 lines
1.3 KiB
Nix

# Hypridle is a daemon that listens for user activity and runs commands when the user is idle.
{ pkgs, ... }: {
services.hypridle = {
enable = true;
settings = {
general = {
ignore_dbus_inhibit = false;
lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
listener = [
{
timeout = 150; # 2.5min.
on-timeout =
"${pkgs.brightnessctl}/bin/brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume =
"${pkgs.brightnessctl}/bin/brightnessctl -r"; # monitor backlight restore.
}
{
timeout = 300;
on-timeout = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
}
{
timeout = 430; # 5.5min
on-timeout =
"${pkgs.hyprland}/bin/hyprctl dispatch dpms off"; # screen off when timeout has passed
on-resume =
"${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
}
{
timeout = 960;
on-timeout = "systemctl sleep";
}
];
};
};
}