fix: handle multiple Hyprland sockets in recovery/wake scripts
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.
This commit is contained in:
parent
4e8a6fad37
commit
7d2a0100e9
2 changed files with 20 additions and 8 deletions
|
|
@ -5,16 +5,22 @@
|
|||
|
||||
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
||||
|
||||
# Find the Hyprland instance signature from the socket directory
|
||||
SIGNATURE=$(ls "$XDG_RUNTIME_DIR/hypr/" 2>/dev/null | head -1)
|
||||
# Find the active Hyprland instance by trying each socket until one responds
|
||||
for SIG in "$XDG_RUNTIME_DIR/hypr"/*/; do
|
||||
[ -d "$SIG" ] || continue
|
||||
SIGNAME=$(basename "$SIG")
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$SIGNAME
|
||||
if hyprctl monitors >/dev/null 2>&1; then
|
||||
FOUND=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$SIGNATURE" ]; then
|
||||
echo "Could not find Hyprland socket. Is Hyprland running?"
|
||||
if [ -z "$FOUND" ]; then
|
||||
echo "Could not find active Hyprland socket. Is Hyprland running?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$SIGNATURE
|
||||
|
||||
echo "Resetting display pipeline..."
|
||||
|
||||
pkill hyprlock 2>/dev/null
|
||||
|
|
|
|||
|
|
@ -3,10 +3,16 @@
|
|||
# Cycles DPMS only if the display was actually turned off (avoids flicker
|
||||
# when the user returns before step 3 fires).
|
||||
|
||||
SIGNATURE=$(ls "$XDG_RUNTIME_DIR/hypr/" 2>/dev/null | head -1)
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$SIGNATURE
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue