#!/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=("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 custom bspwm xsession to /usr/share/xsessions/? It needs to become root (y/N):"
read advanced_install

case "${advanced_install}" in
	"Y" | "y")
		su root -c "cp -vf ./bspwm_session/* /usr/share/xsessions/"
	;;
	"N" | "n" | "*")
		echo "Skip"
	;;
esac