nixcfg/homeManagerModules/services/hypridle/default.nix
Aly Raffauf 8cce973179
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / adjustor-build (push) Waiting to run
nix-build / clean-install-build (push) Waiting to run
nix-build / emudeck-build (push) Waiting to run
nix-build / hhd-ui-build (push) Waiting to run
nix-build / rofi-bluetooth-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / pacifidlog-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
hypridle: fixed syntax error in suspend timeout
2024-11-27 07:48:50 -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";
};
};
}