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:
@@ -4,11 +4,24 @@
|
|||||||
|
|
||||||
SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
|
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
|
socat -U - "UNIX-CONNECT:$SOCKET" | while read -r event; do
|
||||||
case "$event" in
|
case "$event" in
|
||||||
monitorremoved\>\>*|monitorremovedv2\>\>*)
|
monitorremoved\>\>*|monitorremovedv2\>\>*)
|
||||||
omarchy-hyprland-monitor-internal recover
|
recover_after_monitor_removal
|
||||||
omarchy-hyprland-monitor-internal-mirror recover
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ if [[ ! $wait_attempts =~ ^[0-9]+$ ]] || (( wait_attempts < 1 )); then
|
|||||||
wait_attempts=100
|
wait_attempts=100
|
||||||
fi
|
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
|
omarchy-shell lock lock >/dev/null 2>&1 || exit 1
|
||||||
|
|
||||||
for (( attempt = 0; attempt < wait_attempts; attempt++ )); do
|
for (( attempt = 0; attempt < wait_attempts; attempt++ )); do
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
||||||
|
|
||||||
|
monitor_watch="$ROOT/bin/omarchy-hyprland-monitor-watch"
|
||||||
|
sleep_lock="$ROOT/bin/omarchy-system-sleep-lock"
|
||||||
|
|
||||||
|
grep -F 'recover_after_monitor_removal' "$monitor_watch" >/dev/null
|
||||||
|
grep -F 'sleep 1' "$monitor_watch" >/dev/null
|
||||||
|
grep -F 'omarchy-hyprland-monitor-internal recover' "$monitor_watch" >/dev/null
|
||||||
|
grep -F 'omarchy-hyprland-monitor-internal-mirror recover' "$monitor_watch" >/dev/null
|
||||||
|
pass "monitor watcher retries internal monitor recovery after removal"
|
||||||
|
|
||||||
|
grep -F 'omarchy-hyprland-monitor-internal recover >/dev/null 2>&1 || true' "$sleep_lock" >/dev/null
|
||||||
|
grep -F 'omarchy-hyprland-monitor-internal-mirror recover >/dev/null 2>&1 || true' "$sleep_lock" >/dev/null
|
||||||
|
pass "sleep lock recovers internal monitor toggles before suspend"
|
||||||
Reference in New Issue
Block a user