summaryrefslogtreecommitdiff
path: root/modules/programs/hypr/hypridle.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs/hypr/hypridle.nix')
-rw-r--r--modules/programs/hypr/hypridle.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/programs/hypr/hypridle.nix b/modules/programs/hypr/hypridle.nix
new file mode 100644
index 0000000..f69db63
--- /dev/null
+++ b/modules/programs/hypr/hypridle.nix
@@ -0,0 +1,56 @@
+{ config, pkgs, lib, inputs, ... }:
+
+let
+ # inputs
+ system = pkgs.stdenv.hostPlatform.system;
+ hypridle = inputs.hypridle.packages.${system};
+in
+{
+ config = lib.mkIf config.desktop.enable {
+
+ home-manager.users.${config.user} = {
+ services.hypridle = {
+
+ enable = true;
+ package = hypridle.hypridle;
+
+ settings = {
+ general = {
+ lock_cmd = "pidof hyprlock || hyprlock";
+ before_sleep_cmd = "loginctl lock-session";
+ after_sleep_cmd = "hyprctl dispatch dpms on";
+ ignore_dbus_inhibit = false;
+ };
+
+ listener = [
+ # dim screen
+ {
+ timeout = 150;
+ on-timeout = "brightnessctl -s set 10";
+ on-resume = "brightnessctl -r";
+ }
+ # dim keyboard backlight
+ {
+ timeout = 150;
+ on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0";
+ on-resume = "brightnessctl -rd rgb:kbd_backlight";
+ }
+ # lock
+ {
+ timeout = 300;
+ on-timeout = "loginctl lock-session";
+ }
+ # turn off screen
+ {
+ timeout = 350;
+ on-timeout = "hyprctl dispatch dpms off";
+ on-resume = "hyprctl dispatch dpms on";
+ }
+ ];
+ };
+ };
+ };
+
+ };
+}
+