Both scripts used ls | head -1 to find the socket, which picks the wrong (dead) session when old socket dirs linger. Now iterates over all sockets and picks the one that actually responds.
26 lines
807 B
Bash
Executable file
26 lines
807 B
Bash
Executable file
#!/bin/bash
|
|
# hypridle step 3 on-resume — wake display after idle off.
|
|
# Cycles DPMS only if the display was actually turned off (avoids flicker
|
|
# when the user returns before step 3 fires).
|
|
|
|
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
|
|
|
# Find the active Hyprland socket (not old/stale ones)
|
|
for SIG in "$XDG_RUNTIME_DIR/hypr"/*/; do
|
|
[ -d "$SIG" ] || continue
|
|
SIGNAME=$(basename "$SIG")
|
|
export HYPRLAND_INSTANCE_SIGNATURE=$SIGNAME
|
|
hyprctl monitors >/dev/null 2>&1 && break
|
|
done
|
|
|
|
DPMS=$(hyprctl monitors 2>/dev/null | grep dpmsStatus | awk '{print $2}')
|
|
|
|
if [ "$DPMS" = "0" ]; then
|
|
# Display was off — cycle DPMS to force re-creation of hyprlock surfaces
|
|
hyprctl dispatch dpms off
|
|
sleep 1
|
|
fi
|
|
|
|
hyprctl dispatch dpms on
|
|
ddcutil setvcp 10 100
|
|
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|