#!/bin/sh
#(c) Copyright Barry Kauler April 2013, bkhome.org
#license GPL3 (see /usr/share/doc/legal).
#130329 first release.
#130401 01micko: preliminary gtk3 support.
#130404 01micko: link to actual theme.

gtk-chtheme

#make Qt4 apps theme match gtk2...
#see also /etc/profile.d/pup_gtk and /root/.config/Trolltech.conf
#/root/.gtkrc-2.0 typically looks like this:
## -- THEME AUTO-WRITTEN DO NOT EDIT
#include "/usr/share/themes/Polished-Blue/gtk-2.0/gtkrc"
#
#include "/root/.gtkrc.mine"
#
## -- THEME AUTO-WRITTEN DO NOT EDIT
CURRGTKTHEME="$(grep '^include "/usr/share/themes/' /root/.gtkrc-2.0 | cut -f 5 -d '/')" #'geany  ex: Polished-Blue
THEREBEFORE="$(grep '^gtk-theme-name' /root/.gtkrc-2.0)"
if [ "$THEREBEFORE" = "" ];then

 echo "gtk-theme-name=\"${CURRGTKTHEME}\"" >> /root/.gtkrc-2.0

 #130401...
 # gtk3 theme support thunor http://murga-linux.com/puppy/viewtopic.php?p=695722#695722
 pathGTK3THEME="`find /usr/share/themes/${CURRGTKTHEME} -type d -name gtk-3.0`"
 if [ "$pathGTK3THEME" ];then #XDG_CONFIG_HOME=/root/.config
  #130404 link to actual theme...
  ln -snf "$pathGTK3THEME" ${XDG_CONFIG_HOME}/gtk-3.0
 fi
fi
