#/bin/bash
         
# Load Library
source $(dirname "$0")/scripts/library.sh

# install yay
cd ..
git clone https://aur.archlinux.org/yay-git.git
cd yay-git
makepkg -si
cd ../dotfiles

# Install required packages
packagesPacman=(
    "pacman-contrib"
    "networkmanager"
    "alacritty"
    "kitty"
    "rofi" 
    "firefox"
    "firefox-i18n-de"
    "nitrogen" 
    "dunst" 
    "starship"
    "neovim" 
    "mpv" 
    "thunderbird"
    "thunderbird-i18n-de"
    "xfce4-power-manager" 
    "mousepad"
    "ranger"
    "thunar"
    "keepassxc"
    "ttf-font-awesome" 
    "ttf-fira-sans" 
    "ttf-fira-code" 
    "ttf-firacode-nerd" 
    "exa"
    "bat"
    "tree"
    "python-pip" 
    "python-psutil" 
    "python-rich" 
    "python-click" 
    "xdg-desktop-portal-gtk"
    "pavucontrol" 
    "tumbler" 
    "xautolock" 
    "blueman"
    "papirus-icon-theme"
    "ly"
    "hyprland" 
    "xdg-desktop-portal-wlr" 
    "waybar" 
    "grim" 
    "slurp"
    "swayidle"
    "swappy"
    "cliphist"
);

packagesYay=(
    "pfetch"
    "trizen"
    "bibata-cursor-theme" 
    "pywal"
    "swww" 
    "swaylock-effects" 
    "wlogout"
);
  
_installPackagesPacman "${packagesPacman[@]}";
_installPackagesYay "${packagesYay[@]}";

# .config folder
if [ ! -d ~/.config ]; then
    mkdir ~/.config
fi

# .bashrc
_installSymLink .bashrc ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc

#_installSymLink alacritty ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config
_installSymLink kitty ~/.config/kitty ~/dotfiles/kitty/ ~/.config
_installSymLink ranger ~/.config/ranger ~/dotfiles/ranger/ ~/.config
_installSymLink nvim ~/.config/nvim ~/dotfiles/nvim/ ~/.config
_installSymLink starship ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml
_installSymLink rofi ~/.config/rofi ~/dotfiles/rofi/ ~/.config
_installSymLink dunst ~/.config/dunst ~/dotfiles/dunst/ ~/.config
_installSymLink wal ~/.config/wal ~/dotfiles/wal/ ~/.config
_installSymLink thunar ~/.config/Thunar ~/dotfiles/Thunar/ ~/.config

# gtk
_installSymLink .gtkrc-2.0 ~/.gtkrc-2.0 ~/dotfiles/gtk/.gtkrc-2.0 ~/.gtkrc-2.0
_installSymLink gtk-3.0 ~/.config/gtk-3.0 ~/dotfiles/gtk/gtk-3.0/ ~/.config/
_installSymLink gtk-4.0 ~/.config/gtk-4.0 ~/dotfiles/gtk/gtk-4.0/ ~/.config/

# hyprland
_installSymLink hypr ~/.config/hypr ~/dotfiles/hypr/ ~/.config
_installSymLink waybar ~/.config/waybar ~/dotfiles/waybar/ ~/.config
_installSymLink swaylock ~/.config/swaylock ~/dotfiles/swaylock/ ~/.config
_installSymLink wlogout ~/.config/wlogout ~/dotfiles/wlogout/ ~/.config
_installSymLink swappy ~/.config/swappy ~/dotfiles/swappy/ ~/.config

# Copy default wallpaper to .cache for autolock screen
cp ~/dotfiles/wallpapers/default.jpg ~/.cache/current_wallpaper.jpg
cp -r ~/dotfiles/wallpapers ~/wallpaper

# Init pywal
wal -i ~/wallpaper/default.jpg

# start service
sudo systemctl enable networkmanager
sudo systemctl enable ly

# DONE
clear
