#!/bin/bash

set -e

echo "🚀 Installing packages for Hyprland"

# Update system first
# echo "📦 Updating system"
# sudo pacman -Syu --noconfirm

# Core Hyprland packages
echo "🎨 Installing Hyprland apps"
sudo pacman -S --needed --noconfirm \
    hyprland \
    waybar \
    wofi \
    hyprpaper \
    dunst \
    hyprlock \
    hypridle \
    swww

# Essential Wayland tools
echo "🔧 Installing Wayland apps"
sudo pacman -S --needed --noconfirm \
    grim \
    slurp \
    swappy \
    wl-clipboard \
    wayland-utils \
    cliphist \
    libnotify

# Audio and media
echo "🎵 Installing media apps"
sudo pacman -S --needed --noconfirm \
    pavucontrol \
    playerctl \
    mpv \
    ffmpeg \
    gimp \
    imagemagick

# Fonts
echo "🔤 Installing fonts"
sudo pacman -S --needed --noconfirm \
    noto-fonts \
    noto-fonts-cjk \
    noto-fonts-emoji \
    ttf-nerd-fonts-symbols \
    ttf-jetbrains-mono \
    ttf-fira-code

# Development tools
echo "💻 Installing dev tools"
sudo pacman -S --needed --noconfirm \
    npm \
    git \
    github-cli \
    nix \
    bun

# System utilities
echo "🛠️ Installing system tools"
sudo pacman -S --needed --noconfirm \
    htop \
    btop \
    fastfetch \
    wget \
    curl \
    unzip \
    jq \
    networkmanager \
    blueman \
    network-manager-applet \
    ghostty

# Gaming
echo "🎮 Installing gaming stuff"
sudo pacman -S --needed --noconfirm \
    steam \
    gamescope \
    mangohud

# DE
echo "🖥️ Installing DE components"
sudo pacman -S --needed --noconfirm \
    gnome-keyring \
    seahorse \
    polkit-gnome \
    xdg-desktop-portal \
    xdg-desktop-portal-gtk \
    xdg-desktop-portal-wlr \
    qt5ct \
    qt6ct \
    prismlauncher

# File manager
echo "📁 Installing file manager"
sudo pacman -S --needed --noconfirm \
    nautilus

echo "🔍 Installing more tools..."
sudo pacman -S --needed --noconfirm \
    vesktop \
    obs-studio \
    kitty

# Install AUR packages
echo "📦 Installing AUR packages"
if command -v yay &> /dev/null; then
    echo "Using yay for AUR packages..."
    yay -S --needed --noconfirm \
        hyprsysteminfo \
        catppuccin-gtk-theme-mocha \
        catppuccin-cursors-mocha-blue \
        catppuccin-kde \
        catppuccin-papirus-folders \
        catppuccin-waybar-hyprland \
        brave-bin
else
    echo "⚠️  Please install yay"
    echo "sudo pacman -S cachyos/yay"
fi

# Enable services
echo "🔧 Enabling services"
sudo systemctl enable NetworkManager
sudo systemctl enable bluetooth
