#!/bin/bash

old=$(cat /usr/share/config/kdm/kdmrc |grep ^Theme=|xargs basename)
themes=$(ls /usr/share/apps/kdm/themes)
i=0
for t in $themes;do
  echo $t
 if [ $i = 0 ];then
  THEMES="$THEMES TRUE $t"
 else
  THEMES="$THEMES FALSE $t"
 fi 
  ((i++))
done
new=$(zenity --list --title "KDM THEME" --radiolist --column choice \
--column theme --text "Choose a KDM theme." $THEMES)
echo $new
if [ ! "$new" = "" ];then
  sed "s/$old/$new/g" /usr/share/config/kdm/kdmrc >/tmp/kdmrc && \
  mv /tmp/kdmrc /usr/share/config/kdm/kdmrc
fi

