#!/bin/bash

# omarchy:summary=Install lib32 Vulkan drivers for any detected Intel/AMD GPUs (no-op otherwise).
# omarchy:requires-sudo=true

set -e

PACKAGES=()

declare -A VULKAN_DRIVERS=(
  [Intel]=lib32-vulkan-intel
  [AMD]=lib32-vulkan-radeon
)
for vendor in "${!VULKAN_DRIVERS[@]}"; do
  if lspci | grep -iE "(VGA|Display).*$vendor" >/dev/null; then
    PACKAGES+=("${VULKAN_DRIVERS[$vendor]}")
  fi
done

[[ ${#PACKAGES[@]} -gt 0 ]] && omarchy-pkg-add "${PACKAGES[@]}"
