From a5c4aecba2e0f1c8973b3e3e10e4cedfeb193424 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 21 Feb 2026 01:42:52 -0500 Subject: [PATCH] fix(hyprland): use hypridle systemd service instead --- config/hypr/hyprland.conf | 1 - home/modules/hyprland.nix | 43 ++++++++++++++++++--------------------- scripts/ctl | 5 +++-- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index adbb38a..5fd2d30 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -82,7 +82,6 @@ exec-once = wl-paste --watch cliphist store exec-once = [ -f "${XDG_PICTURES_DIR:-$HOME/Pictures}/Screensavers/wallpaper.jpg" ] || ctl wallpaper wall exec-once = [ -f "${XDG_PICTURES_DIR:-$HOME/Pictures}/Screensavers/lock.jpg" ] || ctl wallpaper lock exec-once = hyprpaper -exec-once = hypridle exec-once = hypr windowrules exec-once = hypr spawnfocus --ws 1 $TERMINAL -e mux exec-once = hypr spawnfocus --ws 2 $BROWSER diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix index 05e336a..18307e2 100644 --- a/home/modules/hyprland.nix +++ b/home/modules/hyprland.nix @@ -54,7 +54,6 @@ in ] ++ [ pkgs.hyprlock - pkgs.hypridle ]; xdg.configFile."hypr/themes/midnight.conf".text = mkHyprTheme config.palettes.midnight; @@ -111,26 +110,24 @@ in } ''; - xdg.configFile."hypr/hypridle.conf".text = '' - general { - lock_cmd = ctl wallpaper lock && hyprlock - after_sleep_cmd = hyprctl dispatch dpms on - } - - # listener { - # timeout = 300 - # on-timeout = ctl wallpaper lock && hyprlock - # } - - listener { - timeout = 600 - on-timeout = hyprctl dispatch dpms off - on-resume = hyprctl dispatch dpms on - } - - listener { - timeout = 1800 - on-timeout = systemctl suspend - } - ''; + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "ctl wallpaper lock && hyprlock"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; + listener = [ + { + timeout = 600; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 1800; + on-timeout = "systemctl suspend"; + } + ]; + }; + }; } diff --git a/scripts/ctl b/scripts/ctl index 1876858..88f7b91 100755 --- a/scripts/ctl +++ b/scripts/ctl @@ -400,11 +400,12 @@ power) ;; idle) require notify-send - if pkill hypridle; then + if systemctl --user is-active --quiet hypridle.service; then + systemctl --user stop hypridle.service tmux set -g lock-after-time 0 2>/dev/null notify-send -a ctl -t 2500 'idle off' else - hypridle & + systemctl --user start hypridle.service tmux set -g lock-after-time 300 2>/dev/null notify-send -a ctl -t 2500 'idle on' fi