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:
@@ -1,8 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TOGGLE="internal-monitor-disable"
|
TOGGLE="internal-monitor-disable"
|
||||||
|
TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.conf"
|
||||||
MIRROR_TOGGLE="internal-monitor-mirror"
|
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() {
|
enable() {
|
||||||
if omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
if omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
||||||
omarchy-hyprland-toggle --disabled-notification " Laptop display enabled" "$TOGGLE"
|
omarchy-hyprland-toggle --disabled-notification " Laptop display enabled" "$TOGGLE"
|
||||||
@@ -10,14 +14,15 @@ enable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
if omarchy-hw-external-monitors; then
|
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
|
|
||||||
notify-send -u low " Can't disable the only active display"
|
notify-send -u low " Can't disable the only active display"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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() {
|
recover() {
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# Disable the internal laptop monitor
|
|
||||||
monitor=eDP-1,disable
|
|
||||||
Reference in New Issue
Block a user