fix: prevent black lock screen on dual-GPU system

- AQ_DRM_DEVICES=/dev/dri/card0 forces Aquamarine to use only the
  Intel iGPU, avoiding EGL_BAD_MATCH errors from the NVIDIA RTX 3060
  after VT/DPMS cycles (page-flip lockups, black display)
- lock.sh: guard against duplicate hyprlock instances (second instance
  steals surfaces, leaves screen black)
- lid-close.sh: same guard for laptop
- wake-display.sh: conditional DPMS cycle (only when display is off)
  to restore hyprlock surfaces without flicker
- unstick-display.sh: emergency recovery script for tty3
This commit is contained in:
Jeena 2026-08-15 19:22:38 +09:00
parent 6199866e4c
commit 24344598e9
6 changed files with 69 additions and 6 deletions

View file

@ -2,7 +2,7 @@
pkill -x dim
hyprctl switchxkblayout all 0
wpctl set-mute @DEFAULT_AUDIO_SINK@ 1
hyprlock --no-fade-in &
pidof hyprlock || hyprlock --no-fade-in &
hyprctl dispatch dpms off
wait
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0

View file

@ -1,4 +1,8 @@
#!/bin/bash
# Prevent multiple hyprlock instances (second instance breaks the lock screen)
pidof hyprlock && exit 0
hyprctl switchxkblayout all 0
fcitx5-remote -s keyboard-us-dvorak
wpctl set-mute @DEFAULT_AUDIO_SINK@ 1

25
hypr/scripts/unstick-display.sh Executable file
View file

@ -0,0 +1,25 @@
#!/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 Hyprland instance signature from the socket directory
SIGNATURE=$(ls "$XDG_RUNTIME_DIR/hypr/" 2>/dev/null | head -1)
if [ -z "$SIGNATURE" ]; then
echo "Could not find Hyprland socket. Is Hyprland running?"
exit 1
fi
export HYPRLAND_INSTANCE_SIGNATURE=$SIGNATURE
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)."

20
hypr/scripts/wake-display.sh Executable file
View file

@ -0,0 +1,20 @@
#!/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).
SIGNATURE=$(ls "$XDG_RUNTIME_DIR/hypr/" 2>/dev/null | head -1)
export HYPRLAND_INSTANCE_SIGNATURE=$SIGNATURE
export XDG_RUNTIME_DIR=/run/user/$(id -u)
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