# Loads environment variables and util functions
load_dependencies() {
    # Paths to the important directories
    ROOT_DIRECTORY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

    # Export Lib functions
    set -o allexport
    for f in $ROOT_DIRECTORY/lib/*; do source $f; done
    set +o allexport

    # Export all the variables
    export ROOT_DIRECTORY
}

# What to do when the program begins
load_dependencies

sudo chmod +x ./scripts/ -R

# Optional.
# ./scripts/misc/nvidia-drivers.sh
# exit

info "Apt update"
sudo apt update >/dev/null 2>&1

# Basics
install kitty
install curl
install wget
install eza
install xclip
install flameshot
./scripts/misc/nerd-font.sh
./scripts/apps/git.sh

# Basic apps
if ! is_installed brave-browser; then
    ./scripts/apps/brave.sh
else
    success "Brave is already installed"
fi

if ! is_installed discord; then
    ./scripts/apps/discord.sh
else
    success "Discord is already installed"
fi

if ! is_installed code; then
    ./scripts/apps/vscode.sh
else
    success "VSCode is already installed"
fi

# Dev tools
./scripts/dev/langs.sh
./scripts/apps/yazi.sh
./scripts/apps/starship-prompt.sh

# Gnome
./scripts/gnome/keybinds.sh
./scripts/gnome/extensions.sh
./scripts/gnome/misc.sh
# Desktop BG
cp ./assets/background.png "$HOME/background.png"
gsettings set org.gnome.desktop.background picture-uri "file://$HOME/background.png"

# Ansible
install software-properties-common
install ansible
