#!/bin/sh

if [ "${1}" = "" ]; then
    echo "Enable and set the Camaelon theme, or disable Camaelon."
    echo "Usage: Camaelon [THEME|Off]"
    echo
    echo "Available themes:"
    ls -1d /usr/lib/GNUstep/Bundles/Camaelon.themeEngine/Resources/*.theme | sed "s,.*/,,"
    echo
    exit
fi

if [ "${1}" = "Off" ]; then
    defaults delete NSGlobalDomain GSAppKitUserBundles
    defaults delete Camaelon Theme
else
    defaults write NSGlobalDomain GSAppKitUserBundles '("/usr/lib/GNUstep/Bundles/Camaelon.themeEngine")'
    defaults write Camaelon Theme ${1}
fi
