Nice. Problem is that my computer has a tendency of freezing up during the changes, and when I'm playing games or watching movies, I'd prefer it to not switch, so I whipped up a little script that temporarily lowers it scheduling priority.

Code:
#!/bin/bash
#change-background

#get the pid for xfdesktop
pid=`ps -e | grep xfdesktop | gawk '{print $1}'`

#a regular expression containing the names of the processes
#that will defer the switching
deferred='(mplayer|xgame)'

if [[ -z $pid ]] && [[ -n `ps -e | egrep $deferred` ]]; then

else
    renice 19 -p $pid
    kill -USR1 $pid
    renice 0 -p $pid
fi