Fix internal monitor disable for non-eDP-1 systems (#5511)

Detect the internal monitor name dynamically at runtime instead of
hardcoding eDP-1 in a static toggle conf file. Uses the same pattern
as omarchy-hyprland-monitor-internal-mirror.

Fixes #5443
This commit is contained in:
Alexandre
2026-04-30 17:51:29 +02:00
committed by GitHub
parent cbefe54238
commit 5683b1bdbd
2 changed files with 10 additions and 7 deletions
+10 -5
View File
@@ -1,8 +1,12 @@
#!/bin/bash
TOGGLE="internal-monitor-disable"
TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.conf"
MIRROR_TOGGLE="internal-monitor-mirror"
# Get internal monitor name dynamically
INTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1)
enable() {
if omarchy-hyprland-toggle-enabled "$TOGGLE"; then
omarchy-hyprland-toggle --disabled-notification "󰍹 Laptop display enabled" "$TOGGLE"
@@ -10,14 +14,15 @@ enable() {
}
disable() {
if omarchy-hw-external-monitors; then
if omarchy-hyprland-toggle-disabled "$TOGGLE" && omarchy-hyprland-toggle-disabled "$MIRROR_TOGGLE"; then
omarchy-hyprland-toggle --enabled-notification "󰍹 Laptop display disabled" "$TOGGLE"
fi
else
if ! omarchy-hw-external-monitors; then
notify-send -u low "󰍹 Can't disable the only active display"
exit 1
fi
if omarchy-hyprland-toggle-disabled "$TOGGLE" && omarchy-hyprland-toggle-disabled "$MIRROR_TOGGLE"; then
echo "monitor=$INTERNAL,disable" >"$TOGGLE_FLAG"
notify-send -u low "󰍹 Laptop display disabled"
hyprctl reload
fi
}
recover() {