#!/bin/bash

# Get the directory of the current script
BASE_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")/../../")

# Source helper file
source $BASE_DIR/scripts/installer/helper.sh

log_message "Installation started for theming section"
print_info "\nStarting theming setup..."

run_command "pacman -S --noconfirm nwg-look" "Install nwg-look for GTK theme management" "yes" 

run_command "pacman -S --noconfirm qt5ct qt6ct kvantum" "Install Qt5, Qt6 Settings, and Kvantum theme engines" "yes"

run_command "yay -S --sudoloop --noconfirm catppuccin-gtk-theme-mocha" "Install Catppuccin Mocha GTK theme" "yes" "no"

run_command "yay -S --sudoloop --noconfirm catppuccin-cursors-mocha" "Install Catppuccin Mocha cursors" "yes" "no"

run_command "yay -S --sudoloop --noconfirm kvantum-theme-catppuccin-git" "Install Catppuccin theme for Kvantum" "yes" "no"

run_command "cp -r $BASE_DIR/configs/kitty /home/$SUDO_USER/.config/" "Copy Catppuccin theme configuration for Kitty terminal" "yes" "no"

# Add instructions to configure theming
print_info "\nPost-installation instructions:"
print_bold_blue "Set themes and icons:"
echo "   - Run 'nwg-look' and set GTK theme to Catppuccin-Mocha, icon theme to Tela-circle-dracula, cursor to catppuccin-mocha"
echo "   - Open 'kvantummanager' to select and apply the Catppuccin theme"
echo "   - Open 'qt6ct' to set the icon theme"
print_bold_blue "Optional: Catppuccin GRUB theme:"
echo "   - Install via: yay -S catppuccin-grub-theme-git"
echo "   - Then run: sudo grub-install && sudo grub-mkconfig -o /boot/grub/grub.cfg"

echo "------------------------------------------------------------------------"