diff options
| author | Devin Finlinson <devin.finlinson@pm.me> | 2024-07-22 00:23:23 -0600 |
|---|---|---|
| committer | Devin Finlinson <devin.finlinson@pm.me> | 2024-07-22 00:23:23 -0600 |
| commit | cf6a168125d48ceb5cdfc07c0c290daa8882cabc (patch) | |
| tree | 16a04e57ac3083aa14bdf85684c70920425c52f3 /modules/home-manager | |
| parent | f862ee2c8e9c08477fec009d98e82a83a346d19d (diff) | |
add hypridle
Diffstat (limited to 'modules/home-manager')
| -rw-r--r-- | modules/home-manager/hypridle.nix | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/home-manager/hypridle.nix b/modules/home-manager/hypridle.nix new file mode 100644 index 0000000..e0b4ae0 --- /dev/null +++ b/modules/home-manager/hypridle.nix @@ -0,0 +1,45 @@ +{pkgs , ... }: { + services.hypridle = { + enable = true; + settings = + let + dpmsCommand = "${pkgs.hyprland}/bin/hyprctl dispatch dpms"; + brightnessSet = "${pkgs.brightnessctl}/bin/brightnessctl -s %% brightnessctl s"; + # brightnessSet = "${pkgs.brightnessctl}/bin/brightnessctl"; + in { + general = { + lock_cmd = "pidof swaylock || swaylock"; # avoid starting multiple swaylock instances. + # unlock_cmd = "notify-send 'unlock!'" + before_sleep_cmd = "${dpmsCommand} off"; + after_sleep_cmd = "${dpmsCommand} on"; + ignore_dbus_inhibit = false; + }; + listener = [ + { + timeout = 180; + on-timeout = "${brightnessSet} 15%"; + on-resume = "brightnessctl -r"; + } + { #comment out if no keyboard backlight + timeout = 180; + on-timeout = "brightnessctl -sd asus::kbd_backlight set 0"; + on-resume = "brightnessctl -rd asus::kbd_baclkight"; + } + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + { + timeout = 350; + on-timeout = "${dpmsCommand} off"; + on-resume = "${dpmsCommand} on"; + } + { + timeout = 420; + on-timeout = "${brightnessSet} 0% && systemctl suspsend"; + on-resume = "brightnessctl -r"; + } + ]; + }; + }; +} |
