diff --git a/dotfiles/desktop/.config/hypr/hypridle.conf b/dotfiles/desktop/.config/hypr/hypridle.conf index 2411e9c..0506cb0 100644 --- a/dotfiles/desktop/.config/hypr/hypridle.conf +++ b/dotfiles/desktop/.config/hypr/hypridle.conf @@ -6,11 +6,6 @@ general { listener { timeout = 300 - on-timeout = loginctl lock-session -} - -listener { - timeout = 600 - on-timeout = hyprctl dispatch dpms off + on-timeout = ~/.config/hypr/scripts/lock-and-dpms on-resume = hyprctl dispatch dpms on } diff --git a/dotfiles/desktop/.config/hypr/hyprland.conf b/dotfiles/desktop/.config/hypr/hyprland.conf index d592a1e..91d1cc1 100644 --- a/dotfiles/desktop/.config/hypr/hyprland.conf +++ b/dotfiles/desktop/.config/hypr/hyprland.conf @@ -127,7 +127,7 @@ bind = $mod, C, exec, cliphist list | rofi -dmenu -theme ~/.config/rofi/config.r bind = $mod SHIFT, V, exec, pavucontrol bind = $mod SHIFT, F, exec, thunar bind = $mod SHIFT, D, exec, dunstctl set-paused toggle -bind = $mod SHIFT, X, exec, hyprlock +bind = $mod SHIFT, X, exec, ~/.config/hypr/scripts/lock-and-dpms bind = $mod SHIFT, Q, killactive # Screenshots (Hyprland-native: grim/slurp/wl-copy; Flameshot is unstable here) diff --git a/dotfiles/desktop/.config/hypr/scripts/lock-and-dpms b/dotfiles/desktop/.config/hypr/scripts/lock-and-dpms new file mode 100755 index 0000000..94a58ee --- /dev/null +++ b/dotfiles/desktop/.config/hypr/scripts/lock-and-dpms @@ -0,0 +1,14 @@ +#!/bin/sh +# Lock the session, then power off outputs only if the lock is still active. + +set -eu + +lock_delay="${HYPRLOCK_DPMS_DELAY:-30}" + +loginctl lock-session + +( + sleep "$lock_delay" + pidof hyprlock >/dev/null 2>&1 || exit 0 + hyprctl dispatch dpms off +) >/tmp/hyprlock-dpms.log 2>&1 &