#!/bin/bash

# assume xfce

bg=$1

case "$bg" in
*1*|w*)
	bg=65535
	;;
*0*|b*|*)
	bg=0
	;;
esac

xfconf-query --channel xfce4-desktop --list | grep -i color1 | xa1 xfconf-query --channel xfce4-desktop -s $bg -s $bg -s $bg -s 65535 -p

exit

s=$DESKTOP_SESSION
if [ "$s" = mate ]; then
	gconf=mateconftool-2
elif [ "$s" = gnome -o "$s" = gnome-2d -o "$s" = xfce ]; then
	gconf=gconftool-2
else
	s=""
fi

if [ "$s" = "" ]; then
	echo >&2 "unknown DESKTOP_SESSION: $DESKTOP_SESSION"
	exit 1
fi

bg=$1

case "$bg" in
*0*|b*)
	bg=black
	;;
*1*|w*)
	bg=white
	;;
esac

key=/desktop/$s/background/primary_color

$gconf -t string -s $key "$bg"
