Recover internal monitor before sleep

Run internal monitor toggle recovery before the sleep lock path and retry recovery after Hyprland monitor removal events. This gives dock/lid-close races time to settle before suspend or external-display reconnects leave the session without a safe internal display fallback.
This commit is contained in:
David Heinemeier Hansson
2026-06-21 15:42:24 +02:00
parent efd8352dfb
commit 8f6e815c78
3 changed files with 36 additions and 2 deletions
+15 -2
View File
@@ -4,11 +4,24 @@
SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
recover_internal_monitor_toggles() {
omarchy-hyprland-monitor-internal recover
omarchy-hyprland-monitor-internal-mirror recover
}
recover_after_monitor_removal() {
recover_internal_monitor_toggles
(
sleep 1
recover_internal_monitor_toggles
) &
}
socat -U - "UNIX-CONNECT:$SOCKET" | while read -r event; do
case "$event" in
monitorremoved\>\>*|monitorremovedv2\>\>*)
omarchy-hyprland-monitor-internal recover
omarchy-hyprland-monitor-internal-mirror recover
recover_after_monitor_removal
;;
esac
done
+3
View File
@@ -10,6 +10,9 @@ if [[ ! $wait_attempts =~ ^[0-9]+$ ]] || (( wait_attempts < 1 )); then
wait_attempts=100
fi
omarchy-hyprland-monitor-internal recover >/dev/null 2>&1 || true
omarchy-hyprland-monitor-internal-mirror recover >/dev/null 2>&1 || true
omarchy-shell lock lock >/dev/null 2>&1 || exit 1
for (( attempt = 0; attempt < wait_attempts; attempt++ )); do