#!/bin/bash

DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"

function error {
  echo -e "\\e[91m$1\\e[39m"
  exit 1
}

#get theme files
rm -rf ~/geany-themes
git clone --depth 1 https://github.com/codebrainz/geany-themes || error "Failed to git clone the geany themes repository!"

#remove all downloaded themes from .config
files="$(cd ~/geany-themes/colorschemes
ls)"

#no need for that repo anymore
rm -f ~/geany-themes &>/dev/null

IFS=$'\n'

for file in $files ;do
  rm -f ~/".config/geany/colorschemes/$file"
done

#clear geany's color_scheme entry
sed -i 's/color_scheme=.*/color_scheme=/g' ~/.config/geany/geany.conf

exit 0
