From 9914513a3108e5fc6d4843a37bc3fb2f7d483fd7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 2 Jul 2026 22:14:33 -0700 Subject: [PATCH] Unify internal monitor detection across scripts Four scripts matched internal panels with contains("eDP") while omarchy-monitor-state used test("^(eDP|LVDS|DSI)-"), so laptops with LVDS or DSI panels were internal to monitor-state but invisible to the clamshell, mirror, and external-active logic. All five sites now share the inclusive anchored pattern. Co-Authored-By: Claude Fable 5 --- bin/omarchy-hyprland-monitor-clamshell | 2 +- bin/omarchy-hyprland-monitor-external-active | 2 +- bin/omarchy-hyprland-monitor-internal | 2 +- bin/omarchy-hyprland-monitor-internal-mirror | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/omarchy-hyprland-monitor-clamshell b/bin/omarchy-hyprland-monitor-clamshell index ed6ec8ed..813309ff 100755 --- a/bin/omarchy-hyprland-monitor-clamshell +++ b/bin/omarchy-hyprland-monitor-clamshell @@ -8,7 +8,7 @@ CLAMSHELL_FLAG="$TOGGLES_DIR/internal-monitor-clamshell.lua" MANUAL_DISABLE_FLAG="$TOGGLES_DIR/internal-monitor-disable.lua" SCALE_STATE="$TOGGLES_DIR/internal-monitor-scale" -INTERNAL=$(hyprctl monitors all -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1) +INTERNAL=$(hyprctl monitors all -j | jq -r '.[] | select(.name | test("^(eDP|LVDS|DSI)-")).name' | head -n 1) valid_scale() { [[ $1 =~ ^[0-9]+([.][0-9]+)?$ ]] diff --git a/bin/omarchy-hyprland-monitor-external-active b/bin/omarchy-hyprland-monitor-external-active index 93902745..1760e981 100755 --- a/bin/omarchy-hyprland-monitor-external-active +++ b/bin/omarchy-hyprland-monitor-external-active @@ -3,4 +3,4 @@ # omarchy:summary=Returns true when Hyprland has an active external monitor # omarchy:hidden=true -hyprctl monitors -j | jq -e '.[] | select(.name | contains("eDP") | not) | select(.disabled == false)' >/dev/null 2>&1 +hyprctl monitors -j | jq -e '.[] | select(.name | test("^(eDP|LVDS|DSI)-") | not) | select(.disabled == false)' >/dev/null 2>&1 diff --git a/bin/omarchy-hyprland-monitor-internal b/bin/omarchy-hyprland-monitor-internal index c78a54ef..37c50e87 100755 --- a/bin/omarchy-hyprland-monitor-internal +++ b/bin/omarchy-hyprland-monitor-internal @@ -8,7 +8,7 @@ TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.lua" MIRROR_TOGGLE="internal-monitor-mirror" # Get internal monitor name dynamically, including disabled outputs. -INTERNAL=$(hyprctl monitors all -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1) +INTERNAL=$(hyprctl monitors all -j | jq -r '.[] | select(.name | test("^(eDP|LVDS|DSI)-")).name' | head -n 1) wake() { hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })' >/dev/null 2>&1 || true diff --git a/bin/omarchy-hyprland-monitor-internal-mirror b/bin/omarchy-hyprland-monitor-internal-mirror index 85d78154..57531d25 100755 --- a/bin/omarchy-hyprland-monitor-internal-mirror +++ b/bin/omarchy-hyprland-monitor-internal-mirror @@ -8,9 +8,9 @@ TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.lua" DISABLE_TOGGLE="internal-monitor-disable" # Get names dynamically -INTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1) +INTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | test("^(eDP|LVDS|DSI)-")).name' | head -n 1) # Get the first available external monitor -EXTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP") | not).name' | head -n 1) +EXTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | test("^(eDP|LVDS|DSI)-") | not).name' | head -n 1) on() { if [[ -z $EXTERNAL ]]; then