Move to a hardware check for external monitors instead to deal with recover timing
This commit is contained in:
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Returns true when an external monitor is physically connected.
|
||||||
|
# Uses kernel DRM state so the result is independent of Hyprland's startup timing.
|
||||||
|
|
||||||
|
for status in /sys/class/drm/card*-*/status; do
|
||||||
|
[[ "$status" == *-eDP-*/status ]] && continue
|
||||||
|
[[ "$(<"$status")" == "connected" ]] && exit 0
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
@@ -9,7 +9,7 @@ enable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
if omarchy-hyprland-monitors-many; then
|
if omarchy-hw-external-monitors; then
|
||||||
if omarchy-hyprland-toggle-disabled "$TOGGLE"; then
|
if omarchy-hyprland-toggle-disabled "$TOGGLE"; then
|
||||||
omarchy-hyprland-toggle --enabled-notification " Laptop display disabled" "$TOGGLE"
|
omarchy-hyprland-toggle --enabled-notification " Laptop display disabled" "$TOGGLE"
|
||||||
fi
|
fi
|
||||||
@@ -20,7 +20,7 @@ disable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
recover() {
|
recover() {
|
||||||
if omarchy-hyprland-monitors-none && omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
if ! omarchy-hw-external-monitors && omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
||||||
omarchy-hyprland-toggle "$TOGGLE"
|
omarchy-hyprland-toggle "$TOGGLE"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Returns true when there are multiple monitors connected (so we can disable the internal one)
|
|
||||||
|
|
||||||
(( $(hyprctl monitors -j 2>/dev/null | jq length) > 1 ))
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Returns true when no real monitors are connected (ignoring Hyprland's HEADLESS fallback)
|
|
||||||
|
|
||||||
(( $(hyprctl monitors -j 2>/dev/null | jq '[.[] | select(.name | startswith("HEADLESS") | not)] | length') == 0 ))
|
|
||||||
Reference in New Issue
Block a user