#!/bin/bash

function install_config() {
	for config in ${@:2}; do
		cp -vr "./${config}" "$1"
	done
}

green="\e[92m"
dgreen="\e[32m"
end="\e[0m"

general_configs=("betterlockscreen" "btop" "picom" "zathura" "rofi" "yazi" "dunst" "mimeapps.list" "starship.toml")
home_dir_configs=(".bg" ".zshrc" ".zsh")

echo -e "${green}
 _    __      _     ____    _
| |  / /___  (_)___/ / /   (_)___  __  ___  __
| | / / __ \/ / __  / /   / / __ \/ / / / |/_/
| |/ / /_/ / / /_/ / /___/ / / / / /_/ />  <
|___/\____/_/\__,_/_____/_/_/ /_/\__,_/_/|_|${end}${dgreen}
       ____        __  _____ __
      / __ \____  / /_/ __(_) /__  _____
     / / / / __ \/ __/ /_/ / / _ \/ ___/
    / /_/ / /_/ / /_/ __/ / /  __(__  )
   /_____/\____/\__/_/ /_/_/\___/____/${end}
"

echo "Select your device type (Laptop: L/l, PC: P/p)" 
read type

case "${type}" in
	"L" | "l")
		cp -vrf ./Laptop/* ~/.config/
	;;
	"P" | "p")
		cp -vrf ./PC/* ~/.config/
	;;
	*)
		echo "Please, select your device type correctly"
		exit 1
	;;
esac

install_config ~/.config/ ${general_configs[@]}
install_config ~/ ${home_dir_configs[@]}

betterlockscreen -u ~/.bg/bg_5.png --fx blur --blur 1

echo "Do you want install bspwm_session, X11, fonts and acpid (for laptop) configs? (y/N):"
read advanced_install

case "${advanced_install}" in
	"Y" | "y")
		sudo cp -vfr ./bspwm_session/* /usr/share/xsessions
		sudo cp -vrf ./root_configs/fonts /etc
		if [[ $type == "L" | $type == "l" ]] -; then
			sudo cp -vfr ./root_configs/acpi /etc
		else
		fi
	;;
	"N" | "n" | "*")
		echo "Skip"
	;;
esac
