Setting the Gnome Desktop Background With a Script

By Hal Canary, 2009-09-10 18:23:48 (link)
#computers-code

#!/bin/sh
## Written 2009 Hal Canary
## based on numerous examples
## DTPD
if [ "$#" -lt 1 ] ; then
   X=`basename "$0"`
   echo "Useage:  $X FILENAME"
   exit 1
fi
D=`dirname "$1"`
B=`basename "$1"`
cd $D
X=`pwd`/$B
cd -
if [ ! -f "$X" ] ; then
  echo "not a file: '$X'."
  exit 1
fi
echo "New background: '$X'"
gconftool-2 -t str --set \
  /desktop/gnome/background/picture_filename \
  "$X"
gconftool-2 -t str --set \
  /desktop/gnome/background/picture_options \
  "centered"
exit 0

(back)