# Enable the [multilib] repo (needed for lib32-* and steam) — disabled by default
# on a fresh Arch install. Idempotent.
if ! grep -q '^\[multilib\]' /etc/pacman.conf; then
  info "enabling [multilib] repo"
  sed -i '/^#\[multilib\]/,/^#Include/ s/^#//' /etc/pacman.conf
fi

pacman -Sy

# Install the base package set + the GPU vendor group for this host.
pac_file packages/pacman.txt

case "$GPU" in
  amd)   pac_file packages/graphics-amd.txt ;;
  intel) pac_file packages/graphics-intel.txt ;;
  *)     info "no GPU group for GPU='$GPU'" ;;
esac

# Laptop only: backlight control. Desktop monitors (DP/HDMI) don't expose a
# /sys/class/backlight device — they use DDC/CI (ddcutil) — so brightnessctl has
# nothing to control there and the XF86MonBrightness* binds just no-op.
[ "$IS_DESKTOP" = 0 ] && pacman -S --needed --noconfirm brightnessctl
