mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 04:29:34 +02:00
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
|
||||
@@ -7,6 +7,8 @@ exec-once = uwsm-app -- swayosd-server
|
||||
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||
exec-once = omarchy-cmd-first-run
|
||||
exec-once = omarchy-powerprofiles-init
|
||||
exec-once = omarchy-hyprland-monitor-internal-recover
|
||||
exec-once = uwsm-app -- omarchy-hyprland-monitor-watch
|
||||
|
||||
# Slow app launch fix -- set systemd vars
|
||||
exec-once = systemctl --user import-environment $(env | cut -d'=' -f 1)
|
||||
|
||||
@@ -112,6 +112,7 @@ sddm
|
||||
signal-desktop
|
||||
slurp
|
||||
spotify
|
||||
socat
|
||||
starship
|
||||
sushi
|
||||
swaybg
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
echo "Install socat for the Hyprland monitor event watcher"
|
||||
omarchy-pkg-add socat
|
||||
Reference in New Issue
Block a user