Fix clamshell display recovery
This commit is contained in:
@@ -7,18 +7,29 @@ TOGGLE="internal-monitor-disable"
|
||||
TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.lua"
|
||||
MIRROR_TOGGLE="internal-monitor-mirror"
|
||||
|
||||
# Get internal monitor name dynamically
|
||||
INTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1)
|
||||
# Get internal monitor name dynamically, including disabled outputs.
|
||||
INTERNAL=$(hyprctl monitors all -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1)
|
||||
|
||||
wake() {
|
||||
hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })' >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
on() {
|
||||
if omarchy-hyprland-toggle-enabled $TOGGLE; then
|
||||
omarchy-hyprland-toggle $TOGGLE off
|
||||
omarchy-notification-send -g "Laptop display enabled"
|
||||
fi
|
||||
|
||||
wake
|
||||
}
|
||||
|
||||
off() {
|
||||
if ! omarchy-hw-external-monitors; then
|
||||
if [[ -z $INTERNAL ]]; then
|
||||
omarchy-notification-send -g "No laptop display found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! omarchy-hyprland-monitor-external-active; then
|
||||
omarchy-notification-send -g "Can't disable the only active display"
|
||||
exit 1
|
||||
fi
|
||||
@@ -31,8 +42,12 @@ off() {
|
||||
}
|
||||
|
||||
recover() {
|
||||
if ! omarchy-hw-external-monitors && omarchy-hyprland-toggle-enabled $TOGGLE; then
|
||||
omarchy-hyprland-toggle $TOGGLE off
|
||||
if ! omarchy-hyprland-monitor-external-active; then
|
||||
if omarchy-hyprland-toggle-enabled $TOGGLE; then
|
||||
omarchy-hyprland-toggle $TOGGLE off
|
||||
fi
|
||||
|
||||
wake
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user