dim creates a wlr-layer-shell surface that Hyprland never cleans up when the process exits — leaves an opaque full-screen overlay (pid=-1) covering the entire display until the layer tree is rebuilt. Removing step 1 (dim) from hypridle prevents future occurrences. unstick-display.sh now restarts waybar to force a layer tree rebuild as a recovery measure.
35 lines
980 B
Bash
Executable file
35 lines
980 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
|
|
|
|
# Force a layer tree rebuild to clear orphaned surfaces (e.g. dim_layer)
|
|
pkill -x waybar 2>/dev/null
|
|
hyprctl dispatch exec waybar 2>/dev/null
|
|
|
|
echo "Done. Switch back to Hyprland (Ctrl+Alt+F2)."
|