Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: New system-wide wallpapers

  1. #1
    Join Date
    Nov 2005
    Location
    Curitiba
    Beans
    34
    Distro
    Ubuntu 10.04 Lucid Lynx

    New system-wide wallpapers

    Hello,

    Sorry if this has been answered before, but if you google for gnome desktop wallpaper you get flooded with zillions of links.

    I have some pics I want to make available to all users on my system, I cp them to /usr/share/backgrounds and they did not show up on the change background dialog.

    I know how to add one new background wallpaper, either via browser right-click and via gnome desktop right-click. But now I want to know how to add a bunch of pics at once in such a way they will be available to all users.

    Thanks for any help. Best regards.

  2. #2
    Join Date
    Mar 2007
    Location
    A bit further from nearby
    Beans
    Hidden!
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: New system-wide wallpapers

    Do you have an .xml file inside /usr/share/backgrounds/ ?

    If yes, you can see that it contains the default wallpaper filenames that accessible to all users. Try adding new ones in it.

    Although this one is maybe unecessary, but I do feel it's a good practice to change the ownership and permission of the additional wallpapers as the same as the default ones.

  3. #3
    Join Date
    Nov 2005
    Location
    Curitiba
    Beans
    34
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: New system-wide wallpapers

    Quote Originally Posted by ShodanjoDM View Post
    Do you have an .xml file inside /usr/share/backgrounds/ ?
    No.


    Quote Originally Posted by ShodanjoDM View Post
    Although this one is maybe unecessary, but I do feel it's a good practice to change the ownership and permission of the additional wallpapers as the same as the default ones.
    Indeed. I agree and did it already. But still no new backgrounds on gnome change desktop background applet.

  4. #4
    Join Date
    Mar 2007
    Location
    A bit further from nearby
    Beans
    Hidden!
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: New system-wide wallpapers

    Ok, I copied the ubuntustudio-wallpapers.xml.in file from my ubuntustudio's /usr/share/backgrounds and attached it below.

    Here's the default content:

    <?xml version="1.0"?>
    <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
    <wallpapers>

    <wallpaper>
    <_name>Ubuntu Studio Default</_name>
    <filename>/usr/share/backgrounds/ubuntustudio.jpg</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
    </wallpaper>

    <wallpaper>
    <_name>Ubuntu Studio Gutsy </_name>
    <filename>/usr/share/backgrounds/ubuntustudio-gutsy.png</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
    </wallpaper>

    <wallpaper>
    <_name>Ubuntu Studio Ayo</_name>
    <filename>/usr/share/backgrounds/ubuntustudio-ayo.png</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
    </wallpaper>

    <wallpaper>
    <_name>Ubuntu Studio Graphics </_name>
    <filename>/usr/share/backgrounds/ubuntustudio-brushes.jpg</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
    </wallpaper>

    <wallpaper>
    <_name>Ubuntu Studio Video </_name>
    <filename>/usr/share/backgrounds/ubuntustudio-lense.jpg</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
    </wallpaper>

    </wallpapers>
    Attached Files Attached Files

  5. #5
    Join Date
    Nov 2005
    Location
    Curitiba
    Beans
    34
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: New system-wide wallpapers

    Quote Originally Posted by ShodanjoDM View Post
    Ok, I copied the ubuntustudio-wallpapers.xml.in file from my ubuntustudio's /usr/share/backgrounds and attached it below.
    Cool, many thanks! Edited the file and created the one attached. But still, no luch, no new wallpapers on "Change desktop background" dialog.
    ("Change desktop background" is my translation for "Alterar Plano de Fundo", wich is Brazilian portuguese pt_BR. May be different on en_US. Just to let you know).
    Attached Files Attached Files

  6. #6
    Join Date
    Mar 2007
    Location
    A bit further from nearby
    Beans
    Hidden!
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: New system-wide wallpapers

    Oops, my bad. Should've told you before that the file serves as an example - including the filename. It should works if you change the filename to "ubuntu-wallpapers.xml.in" or "hardy-wallpapers.xml.in".

    This is where I've got the idea from:

    https://code.launchpad.net/~ubuntu-a...lpapers/ubuntu
    Last edited by ShodanjoDM; May 27th, 2008 at 03:46 AM.

  7. #7
    Join Date
    Nov 2005
    Location
    Curitiba
    Beans
    34
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: New system-wide wallpapers

    Quote Originally Posted by ShodanjoDM View Post
    It should works if you change the filename to "ubuntu-wallpapers.xml.in" or "hardy-wallpapers.xml.in".
    Tried both. No luck...

  8. #8
    Join Date
    Sep 2008
    Beans
    6

    Re: New system-wide wallpapers

    Gnome is looking for background.xml-files in /usr/share/gnome-background-properties/ and /usr/local/share/gnome-background-properties/. I don't know why you can't just drop your pictures to /usr/share/backgrounds/ to make them available system-wide like fonts, icons, sounds or anything else. It's a stupid idea, IMHO, to manage wallpapers through xml-files that are not updated/created for example on sessions startup trough just listing picture-files in pictures-directories.(Even on some dumb OS's you can just put pictures to wallpapers-directory and make them available systemwide that way).

    What you can do is:
    - edit the right xml-files (in /usr/share/gnome-background-properties/)
    - just rename your wallpapers to the default ubuntu-wallpaper-names (replace ubuntu ones)
    - Find a solution here:
    http://linux.wikia.com/wiki/How_To_m...le_system-wide

    It would take still a long time to edit backgrounds.xml if you want to make, lets say, all your 100 pictures in (for example) /home/$USER/Pictures/ available as wallpapers for all users. That's why I've created a script to create mybackground.xml-files. It works for me on hardy. It would be possible to execute it on startup. Take a look at how it works:

    Code:
    #!/bin/bash
    clear
    echo "#################################"
    echo "This script makes all pictures in selected custom directory"
    echo "available as your system-wide GNOME wallpapers." 
    # It reads/lists all pictures in selected directory and creates mybackgrounds.xml file in /usr/local/share/gnome-background-properties/. USAGE: Make this script executable (chmod +x backgrounds.sh) and execute it (sudo ./backgrounds.sh or ./backgrounds.sh as root)." 
    echo "#################################"
    echo
    # if doesn't exists creating directory /usr/local/share/gnome-background-properties
    mkdir -p /usr/local/share/gnome-background-properties
    echo "Enter the path to your pictures directory"
    echo \(\for example\: \/home\/myname\/Pictures\/\) 
    echo "Don't forget the slash at the end of pathname!"
    echo -n "$"
    read DIRECTORY
    echo
    if [ ! -d $DIRECTORY ]
    then
        echo "Sorry, you entered wrong path."
        echo "Directory $DIRECTORY doesnot exists"
        echo "You have to start the Script again."	
        exit
    fi
    echo "You selected $DIRECTORY:"
    ls $DIRECTORY > lspictures.txt
    cat lspictures.txt
    echo
    # creating the head of mybackgrounds.xml
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\">
    <wallpapers>" > mybackgrounds.xml
    # looking for all pictures in $DIRECTORY
    echo "OK. Now we are creating mybackgrounds.xml"
    # This script is looking for .png and .jpg files only, but you can add here another file types. The "<options>stretched</options>" should work best for unknow sized files.
    for i in $DIRECTORY*.jpg $DIRECTORY*.png; do
    echo "<wallpaper>
    <name>$i</name>
    <filename>$i</filename>
      <options>stretched</options>
        <pcolor>#8f4a1c</pcolor>
        <scolor>#8f4a1c</scolor>
        <shade_type>solid</shade_type>
      </wallpaper>" >> mybackgrounds.xml
    done
    # creating the bottom of mybackgrounds.xml
    echo "</wallpapers>" >> mybackgrounds.xml
    # Change <name>/path_to/picture</name> to <name>picture</name> and move mybackgrounds.xml  to /usr/local/share/gnome-background-properties/.
    sed 's/<name>\/usr\/share\/backgrounds\//<name>/g' mybackgrounds.xml > /usr/local/share/gnome-background-properties/mybackgrounds.xml
    # if you like to copy mybackgrounds.xml to /usr/share/gnome-background-properties/mybackgrounds.xml as well
    cp /usr/local/share/gnome-background-properties/mybackgrounds.xml /usr/share/gnome-background-properties/mybackgrounds.xml
    # clear now
    rm mybackgrounds.xml
    rm lspictures.txt
    echo
    echo "#################################"
    echo "You're almost done. Log out and back in. Invoke the Desktop"
    echo "Background Change application again, and all your selected" 
    echo "wallpapers should be available."
    echo "#################################"
    echo
    exit 0

  9. #9
    Join Date
    May 2007
    Beans
    14
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: New system-wide wallpapers

    Quote Originally Posted by daemon_cleaner View Post
    I don't know why you can't just drop your pictures to /usr/share/backgrounds/ to make them available system-wide like fonts, icons, sounds or anything else. It's a stupid idea, IMHO, to manage wallpapers through xml-files that are not updated/created for example on sessions startup trough just listing picture-files in pictures-directories.(Even on some dumb OS's you can just put pictures to wallpapers-directory and make them available systemwide that way).
    This is what I tried:
    On my desktop I create a folder with all my custom jpg files.
    In Appearance Preference I open the Wallpaper tab and select 'Add', then I browse to my folder and select all files.
    These files are then available in the background tab.
    In you ~/.gnome2/ folder you will find a brand new backgrounds.xml file with all the references to your custom pictures.

    My guess is that you can do the same with pictures from /usr/share/backgrounds/<any subfolder> and you would copy the generated xml file (in ~/.gnome2) to /usr/share/gnome-background-properties/ubuntu-wallpapers.xml?

    # cat ~/.gnome2/backgrounds.xml > /usr/share/gnome-background-properties/ubuntu-wallpapers.xml did work for me!
    Last edited by wilbertnl; May 7th, 2009 at 06:19 PM.

  10. #10
    Join Date
    Mar 2008
    Location
    Auckland, New Zealand
    Beans
    6
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: New system-wide wallpapers

    Quote Originally Posted by daemon_cleaner View Post
    Gnome is looking for background.xml-files in /usr/share/gnome-background-properties/ and /usr/local/share/gnome-background-properties/. I don't know why you can't just drop your pictures to /usr/share/backgrounds/ to make them available system-wide like fonts, icons, sounds or anything else. It's a stupid idea, IMHO, to manage wallpapers through xml-files that are not updated/created for example on sessions startup trough just listing picture-files in pictures-directories.(Even on some dumb OS's you can just put pictures to wallpapers-directory and make them available systemwide that way).

    What you can do is:
    - edit the right xml-files (in /usr/share/gnome-background-properties/)
    - just rename your wallpapers to the default ubuntu-wallpaper-names (replace ubuntu ones)
    - Find a solution here:
    http://linux.wikia.com/wiki/How_To_m...le_system-wide

    It would take still a long time to edit backgrounds.xml if you want to make, lets say, all your 100 pictures in (for example) /home/$USER/Pictures/ available as wallpapers for all users. That's why I've created a script to create mybackground.xml-files. It works for me on hardy. It would be possible to execute it on startup. Take a look at how it works:

    Code:
    #!/bin/bash
    clear
    echo "#################################"
    echo "This script makes all pictures in selected custom directory"
    echo "available as your system-wide GNOME wallpapers." 
    # It reads/lists all pictures in selected directory and creates mybackgrounds.xml file in /usr/local/share/gnome-background-properties/. USAGE: Make this script executable (chmod +x backgrounds.sh) and execute it (sudo ./backgrounds.sh or ./backgrounds.sh as root)." 
    echo "#################################"
    echo
    # if doesn't exists creating directory /usr/local/share/gnome-background-properties
    mkdir -p /usr/local/share/gnome-background-properties
    echo "Enter the path to your pictures directory"
    echo \(\for example\: \/home\/myname\/Pictures\/\) 
    echo "Don't forget the slash at the end of pathname!"
    echo -n "$"
    read DIRECTORY
    echo
    if [ ! -d $DIRECTORY ]
    then
        echo "Sorry, you entered wrong path."
        echo "Directory $DIRECTORY doesnot exists"
        echo "You have to start the Script again."	
        exit
    fi
    echo "You selected $DIRECTORY:"
    ls $DIRECTORY > lspictures.txt
    cat lspictures.txt
    echo
    # creating the head of mybackgrounds.xml
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\">
    <wallpapers>" > mybackgrounds.xml
    # looking for all pictures in $DIRECTORY
    echo "OK. Now we are creating mybackgrounds.xml"
    # This script is looking for .png and .jpg files only, but you can add here another file types. The "<options>stretched</options>" should work best for unknow sized files.
    for i in $DIRECTORY*.jpg $DIRECTORY*.png; do
    echo "<wallpaper>
    <name>$i</name>
    <filename>$i</filename>
      <options>stretched</options>
        <pcolor>#8f4a1c</pcolor>
        <scolor>#8f4a1c</scolor>
        <shade_type>solid</shade_type>
      </wallpaper>" >> mybackgrounds.xml
    done
    # creating the bottom of mybackgrounds.xml
    echo "</wallpapers>" >> mybackgrounds.xml
    # Change <name>/path_to/picture</name> to <name>picture</name> and move mybackgrounds.xml  to /usr/local/share/gnome-background-properties/.
    sed 's/<name>\/usr\/share\/backgrounds\//<name>/g' mybackgrounds.xml > /usr/local/share/gnome-background-properties/mybackgrounds.xml
    # if you like to copy mybackgrounds.xml to /usr/share/gnome-background-properties/mybackgrounds.xml as well
    cp /usr/local/share/gnome-background-properties/mybackgrounds.xml /usr/share/gnome-background-properties/mybackgrounds.xml
    # clear now
    rm mybackgrounds.xml
    rm lspictures.txt
    echo
    echo "#################################"
    echo "You're almost done. Log out and back in. Invoke the Desktop"
    echo "Background Change application again, and all your selected" 
    echo "wallpapers should be available."
    echo "#################################"
    echo
    exit 0

    Hey daemon_cleaner,

    Your script almost worked for me on jaunty, but it did not handle files with spaces in their names.

    I have modified your script to handle them correctly, it uses 3 variables at the beginning of the file which is all anyone should need to change to get working on their own system. This way it can be run as a daily cron job for example, and would not need user-intervention.

    Cheers
    Clive

    Modified Code follows:
    Code:
    #!/bin/bash
    #
    # This script will take all wallpapers in $WALLPAPER_DIR and
    # make them available as "default" background in the "Change Background" gui
    # frontend in Ubuntu.
    #
    # Basically what it does is create an xml file in the
    # /usr/share/gnome-background-properties directory which is read whenever a
    # user logs into the system.
    #
    # All that should need changing to work in any other user's system is:
    # WALLPAPER_DIR  (line 15)
    # XML_FILE       (line 17)
    ################################################################################
    WALLPAPER_DIR="/usr/local/share/wallpapers"
    CONFIG_DIR="/usr/share/gnome-background-properties"
    XML_FILE="$CONFIG_DIR/shared-wallpapers.xml"
    
    #### 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.
    
         This script should be run as "root" or with "sudo".
         e.g. sudo $0
    ################################################################################
    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
    
    #### Lastly display a message to inform caller to logout and back in. ####
    cat <<EOF
    ################################################################################
         You're almost done. Log out and back in. Invoke the Desktop Background
         Change application again, and all your selected wallpapers should be
         available to use for all users.
    ################################################################################
    
    EOF
    Last edited by clivelr; September 29th, 2009 at 11:25 PM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •