nixcfg/homeManagerModules/services/hypridle/default.nix
Aly Raffauf b7bf1a970a
Some checks failed
nix-build / adjustor-build (push) Has been cancelled
nix-build / clean-install-build (push) Has been cancelled
nix-build / emudeck-build (push) Has been cancelled
nix-build / hhd-ui-build (push) Has been cancelled
nix-build / rofi-bluetooth-build (push) Has been cancelled
nix-build / fallarbor-build (push) Has been cancelled
nix-build / lavaridge-build (push) Has been cancelled
nix-build / mauville-build (push) Has been cancelled
nix-build / pacifidlog-build (push) Has been cancelled
nix-build / petalburg-build (push) Has been cancelled
nix-build / rustboro-build (push) Has been cancelled
nix-build / slateport-build (push) Has been cancelled
nix-check / fmt-check (push) Has been cancelled
nix-check / eval-check (push) Has been cancelled
hypridle: fixed syntax error in suspend timeout
2024-11-27 07:49:04 -05:00

82 lines
2.2 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.ar.home;
in {
config = lib.mkIf cfg.services.hypridle.enable {
programs.hyprlock.enable = true;
services.hypridle = {
enable = true;
settings = {
general = {
after_sleep_cmd = "hyprctl dispatch dpms on";
lock_cmd = "hyprlock";
before_sleep_cmd = "hyprlock --immediate --no-fade-in";
};
listener =
[
{
timeout = 30;
on-timeout = "brightnessctl -sd chromeos::kbd_backlight set 0";
on-resume = "brightnessctl -rd chromeos::kbd_backlight";
}
{
timeout = 120;
on-timeout = "brightnessctl -s set 10";
on-resume = "brightnessctl -r";
}
]
++ lib.optional (!cfg.desktop.autoSuspend) {
timeout = 600;
on-timeout = "hyprlock";
}
++ lib.optional cfg.desktop.autoSuspend {
timeout = 600;
on-timeout = "systemctl suspend";
}
++ lib.optional
(!cfg.desktop.autoSuspend) {
timeout = 630;
on-timeout = "hyprctl dispatch dpms off";
}
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.hyprland.enable)
{
timeout = 630;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
};
};
};
systemd.user.services.hypridle = {
Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target");
Service = {
Environment = lib.mkForce [
"PATH=${
lib.makeBinPath (
(with pkgs; [
bash
brightnessctl
coreutils
hyprlock
systemd
])
++ lib.optional (cfg.desktop.hyprland.enable) config.wayland.windowManager.hyprland.package
)
}"
];
Restart = lib.mkForce "no";
};
Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target";
};
};
}