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,10 @@ general {
inhibit_sleep = 3
lock_cmd = pidof hyprlock || ~/.config/hypr/scripts/lock.sh
before_sleep_cmd = loginctl lock-session
after_sleep_cmd = hyprctl dispatch dpms on
# Cycle dpms off/on after resume: forces Hyprland to recreate the hyprlock
# surfaces and re-grant them keyboard focus, which is otherwise lost after
# suspend (hyprlock shows the clock but ignores typing until a dpms cycle)
after_sleep_cmd = hyprctl dispatch dpms off && sleep 1 && hyprctl dispatch dpms on
}
# Step 1: Dim monitor at 115 sec idle (warning that it will lock soon)
@ -33,13 +36,19 @@ listener {
# Both together ensure the screen is fully off visually and electrically
# When the user becomes active again, restore display
on-resume = hyprctl dispatch dpms on && ddcutil setvcp 10 100 && wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
#
# Cycles DPMS only if the display was actually turned off (avoids flicker
# when the user returns before step 3 fires). Needed because otherwise
# hyprlock surfaces may lose focus after a dpms off cycle
# (same issue covered in after_sleep_cmd above).
on-resume = ~/.config/hypr/scripts/wake-display.sh
# Explanation:
# - hyprctl dispatch dpms on → ensures the display is powered on by the compositor
# - wake-display.sh checks if dpms is off; only then does a dpms off/on
# cycle to force Hyprland to recreate hyprlock surfaces
# - ddcutil setvcp 10 100 → restores monitor brightness to full
#
# Both together guarantee the screen wakes reliably on all monitors
# Both together guarantee the screen wakes reliably
}
# Step 4: Suspend system after 30 min idle