Ensure internal display is turned back on if the external one is disconnected
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Re-enable the internal display if it was toggled off and no external monitors
|
||||
# are currently active (e.g. external got disconnected live, during sleep, or
|
||||
# wasn't present on boot).
|
||||
|
||||
if omarchy-hyprland-toggle-enabled internal-monitor-disable; then
|
||||
ACTIVE_COUNT=$(hyprctl monitors -j 2>/dev/null | jq 'length')
|
||||
if [[ ${ACTIVE_COUNT:-0} -eq 0 ]]; then
|
||||
omarchy-hyprland-toggle \
|
||||
--disabled-notification " Internal display restored (no external connected)" \
|
||||
internal-monitor-disable
|
||||
fi
|
||||
fi
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Listen on Hyprland's event socket and recover the internal display whenever
|
||||
# a monitor is removed.
|
||||
|
||||
SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
|
||||
|
||||
socat -U - "UNIX-CONNECT:$SOCKET" | while read -r event; do
|
||||
case "$event" in
|
||||
monitorremoved\>\>*|monitorremovedv2\>\>*)
|
||||
omarchy-hyprland-monitor-internal-recover
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user