How do I set another search directory for wallpapers?

I keep all my documents on a separate drive from my ubuntu installation, and I have a folder full of nice wallpapers on that drive. How can I make ubuntu automatically search this directory so wallpapers show up in the wallpaper changer dialogue, reached from right clicking on the desktop and selecting Change Desktop Wallpaper?

Edit: I've tried putting a symlink in the /usr/share/backgrounds folder to the other drive and that didn't work.


* EDIT - Second try - and apologies immediately for all the terminal work - hopefully this should just be copying and pasting the highlighted entries*

the folder that holds the details of the gnome wallpapers is called /usr/share/gnome-background-properties/ubuntu-wallpapers.xml

You could edit that file to have wallpaper.../wallpaper sub-sections pointing to your new folder & wallpaper files

Below is a script amended from this forum entry which will regenerate the ubuntu-wallpapers.xml file automatically for a folder containing .png and .jpg files.

copy and paste the contents into a new text file called "ubuntu-wallpaper-generator"

Then execute the file with the syntax

sh ubuntu-wallpaper-generator <path to new wallpaper folder>

This will generate a file called ubuntu-wallpapers.xml in the same folder as where you are running this script.

Safely backup you current xml file i.e.

sudo cp /usr/share/gnome-background-properties/ubuntu-wallpapers.xml /usr/share/gnome-background-properties/ubuntu-wallpapers.xml.backup

the copy in the newly generated file

sudo cp ubuntu-wallpapers.xml /usr/share/gnome-background-properties/ubuntu-wallpapers.xml

Here is that script file I referred to:

#!/bin/bash
#
# This script will take all wallpapers in a given folder and
# make them available as "default" background in the "Change Background" gui
# frontend in Ubuntu.
#
################################################################################

#CONFIG_DIR="/usr/share/gnome-background-properties"
CONFIG_DIR="./"
XML_FILE="$CONFIG_DIR/ubuntu-wallpapers.xml"

if [ $# -ne 1 ]; then
   echo "*** syntax ubuntu-wallpaper-generator <path to wallpaper folder> ***"
   echo "*** for example ***"
   echo "*** ubuntu-wallpaper-generator /usr/share/backgrounds ***"
   exit 1
else
   WALLPAPER_DIR=$1
   echo "*** parameters passed: $1 ***"
fi

#### First check if we have write permissions to the share dirctory. ####
touch $CONFIG_DIR/testfile >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
   echo "**** No permissions to the desktop share directory. ****"
   echo "**** $CONFIG_DIR ****"
   echo "**** Procedure Terminated. ****"
   exit 1
else
   rm $CONFIG_DIR/testfile 2>/dev/null
fi

#### Show the script description message. ###
cat <<EOF

################################################################################
     This script makes all pictures in the $WALLPAPER_DIR
     directory available to all users defined on this system as their
     system-wide GNOME wallpapers.
################################################################################
EOF

#### Fail if the wallpaper directory does not exist. ####
if [ ! -d $WALLPAPER_DIR ]; then
    echo "**** The wallpaper directory \"$WALLPAPER_DIR\" does not exist. ****"
    echo "**** Precedure Terminated. ****"
    exit 1
fi

#### Count the number of jpg/jpeg/png images. ####
numfiles=`ls -1 $WALLPAPER_DIR/*.jpg WALLPAPER_DIR/*.jpeg WALLPAPER_DIR/*.png 2>/dev/null | wc -l`

#### If there are no image files there then exit. ####
if [ $numfiles -eq 0 ]; then
    echo "**** The wallpaper directory \"$WALLPAPER_DIR\" has no images. ****"
    echo "**** Precedure Terminated. ****"
    exit 1
fi

#### Now we create the XML file containing the images for backgrounds. ####
#### Start by creating the header in the XML file. ####
cat <<EOF > $XML_FILE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
EOF

#### Add each file to the XML file. ####
#### Doing it this way makes sure files with spaces in their names are ####
#### handled properly.   (ls .... | while read fname; do)              ####
ls -1 $WALLPAPER_DIR/*.jpg $WALLPAPER_DIR/*.png $WALLPAPER_DIR/*.jpeg 2> /dev/null |
while read image_name; do
   echo "   Adding: `basename "$image_name"`."
   fname=`basename "$image_name"`
   fname="${fname%%\.*}"
   echo "  <wallpaper>"                          >> $XML_FILE
   echo "    <name>$fname</name>"                >> $XML_FILE
   echo "    <filename>$image_name</filename>"   >> $XML_FILE
   echo "    <options>stretched</options>"       >> $XML_FILE
   echo "    <pcolor>#c58357</pcolor>"           >> $XML_FILE
   echo "    <scolor>#c58357</scolor>"           >> $XML_FILE
   echo "    <shade_type>solid</shade_type>"     >> $XML_FILE
   echo "  </wallpaper>"                         >> $XML_FILE
done

#### Create the footer for the XML file. ####
echo "</wallpapers>"                             >> $XML_FILE

cat <<EOF
################################################################################
     You're almost done. copy the generated file ubuntu-wallpapers.xml to the
     folder /usr/shared/gnome-background-properties
     REMEMBER to backup the current ubuntu-wallpaper.xml in that folder first!
################################################################################

EOF

With CreBS (Create Background Slideshow) you can create the XML files for wallpaper slideshows -- the fullpaths to the images are stored in the XML so no moving of files needed.

https://launchpad.net/crebs

http://www.obfuscatepenguin.net/crebs/