#!/bin/bash

#©keithhedger Fri 2 Aug 12:21:33 BST 2013 kdhedger68713@gmail.com

ICONARRAY=
ARRAYNUM=0

makeArray ()
{
	while read
		do
			if [ ${REPLY:0:1} != "[" ];then
				ICONARRAY[$ARRAYNUM]="$REPLY"
				((ARRAYNUM=ARRAYNUM+1))
			fi
		done< <(xfce-theme-manager -l i)
}


makeArray

if [ -e ~/.config/XfceThemeManager/iconnumber ];then
	ICONNUM=$(cat ~/.config/XfceThemeManager/iconnumber)
	if [ $ICONNUM -ge ${#ICONARRAY[@]} ];then
		ICONNUM=0
	fi
else
	ICONNUM=0
fi

xfce-theme-manager  -i "${ICONARRAY[ICONNUM]}"
((ICONNUM++))
echo -n $ICONNUM > ~/.config/XfceThemeManager/iconnumber
