44 lines
1.3 KiB
Nix
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";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|