#!/bin/sh

alias nls='gettext -d cursorconfig'
file=~/.icons/default/index.theme
themes="core `ls -d /usr/share/icons/*/cursors | sed -e 's,/usr/share/icons/,,;s,/cursors,,'`"
default=`grep -s Inherits $file | cut -f2 -d=`
[ -z $default ] || default="($default)"

theme=`dialog --title 'Cursorconfig' \
	--backtitle "$(nls 'PLD Linux X Cursor Configuration Utility')" \
	--one-column \
	--menu "$(nls 'Available themes:') $default" $(($(echo $themes | wc -w)+7)) 60 0 \
	$themes`
[ -z $theme ] && exit 0

mkdir -p ~/.icons/default || exit 1
[ -f $file ] && mv -f $file{,.old}
echo "[Icon Theme]" > $file
echo "Inherits=$theme" >> $file
