mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
57 lines
1.4 KiB
Bash
Executable File
57 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Enable, disable, toggle, or recover the internal laptop display
|
|
# omarchy:args=<on|off|toggle|recover>
|
|
|
|
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)
|
|
|
|
on() {
|
|
if omarchy-hyprland-toggle-enabled $TOGGLE; then
|
|
omarchy-hyprland-toggle $TOGGLE off
|
|
omarchy-notification-send -g "Laptop display enabled"
|
|
fi
|
|
}
|
|
|
|
off() {
|
|
if ! omarchy-hw-external-monitors; then
|
|
omarchy-notification-send -g "Can't disable the only active display"
|
|
exit 1
|
|
fi
|
|
|
|
if omarchy-hyprland-toggle-disabled $TOGGLE && omarchy-hyprland-toggle-disabled $MIRROR_TOGGLE; then
|
|
printf 'hl.monitor({ output = "%s", disabled = true })\n' "$INTERNAL" >"$TOGGLE_FLAG"
|
|
omarchy-notification-send -g "Laptop display disabled"
|
|
hyprctl reload
|
|
fi
|
|
}
|
|
|
|
recover() {
|
|
if ! omarchy-hw-external-monitors && omarchy-hyprland-toggle-enabled $TOGGLE; then
|
|
omarchy-hyprland-toggle $TOGGLE off
|
|
fi
|
|
}
|
|
|
|
toggle() {
|
|
if omarchy-hyprland-toggle-enabled $TOGGLE; then
|
|
on
|
|
else
|
|
off
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
on) on ;;
|
|
off) off ;;
|
|
toggle) toggle ;;
|
|
recover) recover ;;
|
|
*)
|
|
echo "Usage: $(basename "$0") {on|off|toggle|recover}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|