#!/bin/bash

PICOM_SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
picomDebianSource="--single-branch --branch next-rebase --depth=1 https://github.com/ibhagwan/picom"
picom_req_list_debian=(libxext-dev libxcb1-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-composite0-dev libxcb-image0-dev libxcb-present-dev libxcb-xinerama0-dev libxcb-glx0-dev libpixman-1-dev libdbus-1-dev libconfig-dev libgl-dev libegl-dev libpcre2-dev libevdev-dev uthash-dev libev-dev libx11-xcb-dev meson libpcre++-dev)

intro()
{
	graphics_install_prompt "Picom Will be installed"
}

outro()
{
	graphics_install_prompt "Picom installation complete"
	cd $MAIN_DIR
}


install_picom()
{
	intro

	cd $PICOM_SCRIPT_DIR

	case $OS in
	  debian)
		graphics_install_prompt "For Debian The verison which supports rounded edges"
		graphics_install_prompt "Source : $picomDebianSource"

		install_from_list "${picom_req_list_debian[@]}"
		git clone $picomDebianSource 
		ls
		cd picom 
		echo "meson setup --buildtype=release . build"
		echo "sudo ninja -C build install"
		cd .. 
		sudo rm -r picom
		;;

	  arch)
		sudo pacman -S picom
		;;

	  rasberry)
		;;

	  *)
		echo "Invalid os is selectred"
		exit_abord
		;;
	esac
	
	mkdir -p $USER_DOTFILE_DIR/picom

	cp $DOTFILE_DIR/picom/picom_$OS.conf $USER_DOTFILE_DIR/picom/picom.conf
	
	picom --config $USER_DOTFILE_DIR/picom/picom.conf &

	outro
}
