From c45d7b19f818b137c177a3d32e03191b19e7b9c5 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Thu, 13 Jun 2024 22:24:53 +0200 Subject: [PATCH] add hypridle --- modules/home/hyprland/default.nix | 36 ++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix index 7a1edc5..4771273 100644 --- a/modules/home/hyprland/default.nix +++ b/modules/home/hyprland/default.nix @@ -37,9 +37,9 @@ in home.packages = with pkgs; [ wofi xfce.thunar - # hyprlock - # hyprpicker - hyprcursor + # hyprpicker # TODO + # hyprcursor # TODO + brightnessctl ]; programs.hyprlock.enable = true; @@ -75,6 +75,36 @@ in ]; }; + services.hypridle = { + enable = true; + settings = { + general = { + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + lock_cmd = "hyprlock"; + }; + + listener = [ + { + timeout = 300; # 5min + on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + on-resume = "brightnessctl -r"; # monitor backlight restore. + } + + { + timeout = 360; # 6min + on-timeout = "hyprlock"; # lock screen when timeout has passed + } + + { + timeout = 600; # 10min + on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed + on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired. + } + ]; + }; + }; + programs.waybar = { enable = true; systemd.enable = true;