hypr-dotfiles/hypr/scripts/unstick-display.sh
Jeena 7d2a0100e9 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.
2026-08-19 14:24:37 +09:00

31 lines
837 B
Bash
Executable file

#!/bin/bash
# Recovery script for when Hyprland display goes black after lock/sleep.
# This resets the display pipeline without killing your session.
# Run from another TTY (Ctrl+Alt+F3).
export XDG_RUNTIME_DIR=/run/user/$(id -u)
# 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 "$FOUND" ]; then
echo "Could not find active Hyprland socket. Is Hyprland running?"
exit 1
fi
echo "Resetting display pipeline..."
pkill hyprlock 2>/dev/null
hyprctl dispatch dpms off
sleep 1
hyprctl dispatch dpms on
echo "Done. Switch back to Hyprland (Ctrl+Alt+F2)."