#!/bin/sh

if [ x"$CHOICESPATH" = x"" ] ; then
  XDG_CONFIG_HOME="$HOME/.config"
else
  XDG_CONFIG_HOME=`echo $CHOICESPATH | sed s/:.*//`
fi

# Ensure theme is cached, or window manager may freeze while loading it...
echo < `dirname $0`/themerc > /dev/null

[ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME"
[ -d "$XDG_CONFIG_HOME/OroboROX" ] || mkdir "$XDG_CONFIG_HOME"/OroboROX
cd "$XDG_CONFIG_HOME"/OroboROX || exit 1

# Write new theme setting
dirname "$0" > current_theme

# Signal OroboROX to reload settings...
orobopid=`xprop -root _NET_WM_PID | cut -d' ' -f3`
kill -HUP $orobopid
