From e97aef4a957efaa1ba3f814752d8ed458be82c47 Mon Sep 17 00:00:00 2001 From: andrey_varnavskiy Date: Sun, 1 Dec 2024 05:29:20 +0500 Subject: [PATCH] add hypridle --- home-manager/modules/hyprland/default.nix | 1 + home-manager/modules/hyprland/hypridle.nix | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 home-manager/modules/hyprland/hypridle.nix diff --git a/home-manager/modules/hyprland/default.nix b/home-manager/modules/hyprland/default.nix index dcc8f83..ba8b442 100644 --- a/home-manager/modules/hyprland/default.nix +++ b/home-manager/modules/hyprland/default.nix @@ -2,6 +2,7 @@ imports = [ ./binds.nix ./hyprlock.nix + ./hypridle.nix ./main.nix ]; } diff --git a/home-manager/modules/hyprland/hypridle.nix b/home-manager/modules/hyprland/hypridle.nix new file mode 100644 index 0000000..16966e1 --- /dev/null +++ b/home-manager/modules/hyprland/hypridle.nix @@ -0,0 +1,34 @@ +{ + services.hypridle = { + enable = true; + settings = { + general = { + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + lock_cmd = "pidof hyprlock || hyprlock"; + }; + + listener = [ + { + timeout = 180; + on-timeout = "brightnessctl -s set 30"; + on-resume = "brightnessctl -r"; + } + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + { + timeout = 600; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 1200; + on-timeout = "sysemctl suspend"; + } + ]; + }; + }; +}