Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: How to manage wallpapers with Appearance

  1. #11
    Join Date
    Nov 2012
    Beans
    3

    Re: How to manage wallpapers with Appearance

    Actually, you don't have to add manually your 80 wallpapers. I wrote a script to do that (I have a lot of wallpapers I wanted to add to the appearance menu too ).

    This is the script:

    Code:
    #!/bin/bash
    
    # Freecore
    
    # This script creates an xml file that you can
    # put on /usr/share/gnome-background-properties (if you want wallpapers entrys to ALL users, requires administrator rights)
    # or in /home/userA/.local/share/gnome-background-properties (if you want it only for userA).
    
    # Instructions
    # (Realize that the script it's supposed to be runned like this: sh namescript FOLDER/OF/PICTURES/DIRECTION/).
    # Don't forget the last "/".
    # This script creates a file named my-wallpapers.xml.
    # The file will have the xml code that Ubuntu (Gnome) identifies when it search for backgrounds.
    # ATTENTION: The file generated will NOT include hidden folders NOR sub-folders pictures.
    # ATTENTION: The file will include xml code for EACH file, so only put pictures in that folder.
    
    
    xmlFile="my-wallpapers.xml"
    
    echo '<?xml version="1.0" encoding="UTF-8"?>' >> "$xmlFile"
    echo '<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">' >> "$xmlFile"
    echo '<wallpapers>' >> "$xmlFile"
    
    # For each file in the folder ingresed by the user, it wll create an xml entry.
    for img in "$1"*; do
    
         # We'll declare a variable with the entire name of the image (extention  included). It will be used to declare the next variable.
        CompleteName="${img##*/}"
    
        # We'll declare a variable with the name without the extention. It will be the name in the appearance menu
        Name=$(echo "$CompleteName" | cut -d "." -f 1)
    
    
        echo "  <wallpaper>" >> "$xmlFile"
        echo "    <name>$Name</name>" >> "$xmlFile"
        echo "    <filename>$img</filename>" >> "$xmlFile"
        echo "    <options>zoom</options>" >> "$xmlFile"
        echo "    <pcolor>#000000</pcolor>" >> "$xmlFile"
        echo "    <scolor>#000000</scolor>" >> "$xmlFile"
        echo "    <shade_type>solid</shade_type>" >> "$xmlFile"
        echo "  </wallpaper>" >> "$xmlFile"
    
    done
    
    echo '</wallpapers>' >> "$xmlFile"
    
    
    echo 
    echo 
    echo "The file has been created with the pictures in «$1»"
    echo
    All you have to do is put it in a .sh text file and run it in a terminal with something like
    Code:
    sh your-file.sh your/pictures/folder/
    be aware of the last "/". And it's done!

    If you want the wallpapers to be able only in your appearance menu you can put the xml file in your local folder (./local/share...) as I mentioned in the script.

    You can manage to convert the script to a Slideshow creator too with some little changes.

    I hope it'll help some people.

  2. #12
    Join Date
    Jun 2009
    Location
    Summerville, SC
    Beans
    397
    Distro
    Ubuntu Development Release

    Re: How to manage wallpapers with Appearance

    Thanks, Freecore. I've been manually moving pictures over one-by-one on the command line, and I didn't even know about the xml file.

  3. #13
    Join Date
    Jun 2011
    Beans
    62
    Distro
    Ubuntu

    Re: How to manage wallpapers with Appearance

    Nice script. Still unsuitable for ordinary users (read: no terminal allowed).

    I know its Gnome's fault, but since Ubuntu is taking its own path more and more, I wish this would be considered a paper cut (does that program still exist?) and corrected.

    Today I had to add a wallpapers folder to a Windows 7 laptop of a family member and it was as easy as browsing to it. Now it appears as one of the sources for wallpapers when selecting one. It's not rocket science...

    Also, maybe the script can be made to run with upcoming versions of Cuttlefish (the developer promised some "folder watching" for events), so there's a way to set it and forget it.

Page 2 of 2 FirstFirst 12

Tags for this Thread

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
  •