From 5683b1bdbdc893ac90be4b28d1efaccdaa5caa20 Mon Sep 17 00:00:00 2001 From: Alexandre <17xande@gmail.com> Date: Thu, 30 Apr 2026 17:51:29 +0200 Subject: [PATCH] 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 --- bin/omarchy-hyprland-monitor-internal | 15 ++++++++++----- .../hypr/toggles/internal-monitor-disable.conf | 2 -- 2 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 default/hypr/toggles/internal-monitor-disable.conf diff --git a/bin/omarchy-hyprland-monitor-internal b/bin/omarchy-hyprland-monitor-internal index bc5ee0b9..e869a9d2 100755 --- a/bin/omarchy-hyprland-monitor-internal +++ b/bin/omarchy-hyprland-monitor-internal @@ -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() { diff --git a/default/hypr/toggles/internal-monitor-disable.conf b/default/hypr/toggles/internal-monitor-disable.conf deleted file mode 100644 index f5458f94..00000000 --- a/default/hypr/toggles/internal-monitor-disable.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Disable the internal laptop monitor -monitor=eDP-1,disable