#!/bin/bash

# Toggle the internal laptop display on/off using the flag system.

if omarchy-hyprland-flag-missing internal-monitor-disable; then
  ACTIVE_COUNT=$(hyprctl monitors -j | jq 'length')
  if [[ $ACTIVE_COUNT -le 1 ]]; then
    notify-send -u low "󰍹    Can't disable the only active display"
    exit 1
  fi
fi

omarchy-hyprland-flag-toggle \
  --enabled-notification "󰍹    Internal display off" \
  --disabled-notification "󰍹    Internal display on" \
  internal-monitor-disable
