2024-03-14 21:36:28 +01:00
|
|
|
{ inputs, pkgs, lib, hostName, ... }:
|
2024-03-09 17:18:36 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
inputs.hypridle.homeManagerModules.default
|
|
|
|
];
|
|
|
|
|
|
|
|
services.hypridle = {
|
2024-03-14 21:36:28 +01:00
|
|
|
enable = if hostName == "xv-laptop" then true else false;
|
2024-03-09 17:18:36 +01:00
|
|
|
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 = [
|
|
|
|
{
|
2024-03-12 17:31:56 +01:00
|
|
|
timeout = 180; # 2.5min.
|
2024-03-09 17:18:36 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|