How do I set another search directory for wallpapers?

Slipstream

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.

fossfreedom

* 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

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How do I set path to respective bin of the mingw directory

分類Dev

How do I set Min Date in Datepicker from another Datepicker?

分類Dev

How can I search list only the directory?

分類Dev

How do you set a String array equal to another string (Java) (NB: I am using I/O)?

分類Dev

Django Beginner. How do I update all objects and set a certain field to a value that is a function of another field?

分類Dev

How do I find the inode of any directory?

分類Dev

How do i remove the dots in a php directory

分類Dev

How do I cd to CDROM directory

分類Dev

How do I include newlines in a search in less?

分類Dev

how to install the fedora supplemental wallpapers?

分類Dev

How do I incorporate one function into another?

分類Dev

How do I change one username to another?

分類Dev

How do I remove all files from wtihin a certain directory except for a child directory of that directory?

分類Dev

How do I set a mock date in Jest?

分類Dev

How do I set up PreAuthenticationAuthenticationProvider?

分類Dev

How do I set up PreAuthenticationAuthenticationProvider?

分類Dev

How do I set an environment variable?

分類Dev

How do I set the ServiceStack ResponseStatus StatusCode?

分類Dev

How do I set an array ? (JAVA classes)

分類Dev

How do I set themes for widgets in windows?

分類Dev

How Do I Correctly Set a getElementById Object?

分類Dev

How do I set "StyleBoxEmpty" on buttons in Godot?

分類Dev

How Do I set a cookie in fetch request?

分類Dev

How do I set setReverseLayout() in my code?

分類Dev

How do I set a timer for a Parse object?

分類Dev

how do I set keys for JSONObjects in PHP

分類Dev

How do I permanently set the affinity of a process?

分類Dev

How do I set up a virtual host?

分類Dev

How do I set up a xen bridge?

Related 関連記事

  1. 1

    How do I set path to respective bin of the mingw directory

  2. 2

    How do I set Min Date in Datepicker from another Datepicker?

  3. 3

    How can I search list only the directory?

  4. 4

    How do you set a String array equal to another string (Java) (NB: I am using I/O)?

  5. 5

    Django Beginner. How do I update all objects and set a certain field to a value that is a function of another field?

  6. 6

    How do I find the inode of any directory?

  7. 7

    How do i remove the dots in a php directory

  8. 8

    How do I cd to CDROM directory

  9. 9

    How do I include newlines in a search in less?

  10. 10

    how to install the fedora supplemental wallpapers?

  11. 11

    How do I incorporate one function into another?

  12. 12

    How do I change one username to another?

  13. 13

    How do I remove all files from wtihin a certain directory except for a child directory of that directory?

  14. 14

    How do I set a mock date in Jest?

  15. 15

    How do I set up PreAuthenticationAuthenticationProvider?

  16. 16

    How do I set up PreAuthenticationAuthenticationProvider?

  17. 17

    How do I set an environment variable?

  18. 18

    How do I set the ServiceStack ResponseStatus StatusCode?

  19. 19

    How do I set an array ? (JAVA classes)

  20. 20

    How do I set themes for widgets in windows?

  21. 21

    How Do I Correctly Set a getElementById Object?

  22. 22

    How do I set "StyleBoxEmpty" on buttons in Godot?

  23. 23

    How Do I set a cookie in fetch request?

  24. 24

    How do I set setReverseLayout() in my code?

  25. 25

    How do I set a timer for a Parse object?

  26. 26

    how do I set keys for JSONObjects in PHP

  27. 27

    How do I permanently set the affinity of a process?

  28. 28

    How do I set up a virtual host?

  29. 29

    How do I set up a xen bridge?

ホットタグ

アーカイブ