GNOME - dynamic wallpaper? (i.e. html)


Results 1 to 8 of 8

Thread: GNOME - dynamic wallpaper? (i.e. html)

  1. #1
    Join Date
    May 2002
    Location
    Houston, TX
    Posts
    33

    GNOME - dynamic wallpaper? (i.e. html)

    I am using GNOME and want to set my wallpaper to either dynamically reload an image file, or to an html file.

    Distro is Red Hat 8.0

    Any ideas?

    thanks,
    Phil

  2. #2
    Join Date
    Apr 2002
    Location
    England, London
    Posts
    1,141
    I'm sure there is a 3rd party program that will change the background after a predefined time to what ever you want.
    My new Much Improved, Long waited, Website: http://www.mooktakim.freeserve.co.uk

    My latest screen shot. Visit my My Server.

    Registered Linux user #270049
    -----------------------------------------------------
    ** AMD Athlon XP 2001+, Giga-Byte GA-7VRXP MB, 640Mb DDR RAM 333MHz, MSI Geforce 4800SE 128Mb DDR, 40x12x48 Liteon CDRW drive, Flower Cooler CNPS6000-CU, 3x 80mm Fans, ADSL Router, **
    -----------------------------------------------------

  3. #3
    Join Date
    May 2002
    Location
    Houston, TX
    Posts
    33
    Any ideas?

  4. #4
    Join Date
    Apr 2002
    Location
    England, London
    Posts
    1,141
    sorry, never came across one, try looking in google.
    My new Much Improved, Long waited, Website: http://www.mooktakim.freeserve.co.uk

    My latest screen shot. Visit my My Server.

    Registered Linux user #270049
    -----------------------------------------------------
    ** AMD Athlon XP 2001+, Giga-Byte GA-7VRXP MB, 640Mb DDR RAM 333MHz, MSI Geforce 4800SE 128Mb DDR, 40x12x48 Liteon CDRW drive, Flower Cooler CNPS6000-CU, 3x 80mm Fans, ADSL Router, **
    -----------------------------------------------------

  5. #5
    Join Date
    Jan 2010
    Posts
    1

    Dynamic Backgrounds

    The way to accomplish this in Gnome 2.28 and up is by the use of an XML file that refers to the individual files that you wish to switch between. The XML file is then what you set as your background. This is how the Cosmos background that ships with Ubuntu 9.10 works.
    Here is what the XML file for the Cosmos background looks like:
    Code:
    <background>
      <starttime>
        <year>2009</year>
        <month>08</month>
        <day>04</day>
        <hour>00</hour>
        <minute>00</minute>
        <second>00</second>
      </starttime>
    <!-- This animation will start at midnight. -->
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/cloud.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/cloud.jpg</from>
        <to>/usr/share/backgrounds/cosmos/comet.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/comet.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/comet.jpg</from>
        <to>/usr/share/backgrounds/cosmos/earth-horizon.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/earth-horizon.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/earth-horizon.jpg</from>
        <to>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</from>
        <to>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</from>
        <to>/usr/share/backgrounds/cosmos/helix-nebula.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/helix-nebula.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/helix-nebula.jpg</from>
        <to>/usr/share/backgrounds/cosmos/jupiter.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/jupiter.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/jupiter.jpg</from>
        <to>/usr/share/backgrounds/cosmos/sombrero.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/sombrero.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/sombrero.jpg</from>
        <to>/usr/share/backgrounds/cosmos/whirlpool.jpg</to>
      </transition>
      <static>
        <duration>1795.0</duration>
        <file>/usr/share/backgrounds/cosmos/whirlpool.jpg</file>
      </static>
      <transition>
        <duration>5.0</duration>
        <from>/usr/share/backgrounds/cosmos/whirlpool.jpg</from>
        <to>/usr/share/backgrounds/cosmos/cloud.jpg</to>
      </transition>
    </background>
    A nice bit of info to know is that all of the default wallpapers that ship with Ubuntu are located in the directory /usr/share/backgrounds including the XML file for the Cosmos background except it is located in a subdirectory called cosmos with its associated wallpapers.

    I have created a Unix/Linux Shell Script to automate the process of creating an XML file in the format described above. With my script you can specify image files from multiple directories on your computer and you can control the order in which the images will display. Furthermore, my script is not interactive; so you can type all the input at once, check it for correctness, and simply press enter to create the XML file. The script also has error-checking built into it; so if you give it faulty input, it will tell you instead of creating an XML file that you cannot use.

    If you want to use this script, here is how to do it:
    1) Copy the code for the script below into a file called mkwlppr.sh (short for "make wallpaper").
    2) Make the script executable by typing:
    Code:
    sudo chmod 711 mkwlppr.sh
    3) Place this file in the directory /usr/local/bin so that you can run it from any directory by just using its name. Here is the command:
    Code:
    sudo mv mkwlppr.sh /usr/local/bin
    4) Execute the script by simply typing its name to see how it is used; it will tell you what input it requires from you.
    5) Use the script with input to create as many wallpaper XML files as you want. The input that it takes are the name of the target XML file, the number of seconds each image will display (optional), and the files in the order you wish them to display.
    6) Make sure that you have permission to read the new XML file otherwise it will not work. You can accomplish this with this command:
    Code:
    sudo chmod a+r file.xml
    7) Open up the screen where you can select your background. Click the Add... button. Click the drop-down list that says Images and select All Files. Navigate to the XML file you created, select it, and click Open. Your dynamic background should now appear in the list of backgrounds you can choose.

    Important Notes:
    A) Since this script is not interactive, you can use Unix's wildcards with it if you want to use all files in a directory and/or if you do not care about the order of the images.
    B) You can specify paths relative to your current directory, and the script will put the files' absolute paths into the XML file for you; so you can create the XML file anywhere you want and move it afterward without rendering it useless.
    C) If you want to run the script inside the /usr/share/backgrounds/ directory (which is where you will probably want to place the XML file after you create it), you might have problems with permissions unless you run the command with sudo like this:
    Code:
    sudo mkwlppr.sh parameters
    D) If you do not know what duration to specify for the images, simply do not provide a number in the input, and the progam will use a default value. The default duration value is the same as the Cosmos wallpaper that ships with Ubuntu.

    Here is the code for the script:

    Code:
    #!/bin/sh
    #This script creates xml files that can act as dynamic wallpapers for Gnome by referring to multiple wallpapers
    #Coded by David J Krajnik aka Sildoreth
    
    if [ "$*" = "" ]; then
      echo "This script creates xml files that can act as dynamic backgrounds for Gnome by referring to multiple wallpapers";
      echo "Usage: mkwlppr.sh target-file.xml [duration] pic1 pic2 [pic3 .. picN]";
    else
      files=$*;
      #Grab the name of the target xml file
      xmlfile=`echo $files | cut -d " " -f 1`;
      #remove the first item from $files
      files=`echo $files | sed 's/^\<[^ ]*\>//'`;
      if [ "`echo $xmlfile | grep '\.xml$'`" = "" ]; then
        echo "Your target file must be an XML file";
      else
        inputIsValid="true";
        firstItem=`echo $files | cut -d " " -f 1`;
        duration="1795.0";#set the default duration
        if [ "`echo $firstItem | grep '^[0-9]\+\.[0-9]\+$'`" != "" ]; then
          echo "The duration must be an integer";
          files=`echo $files | sed 's/^\<[^ ]*\>//'`;
          inputIsValid="";
        elif [ "`echo $firstItem | grep '^[0-9]\+$'`" != "" ]; then
          #If the item is a number, then use it as the duration for each wallpaper image
          duration="`expr $firstItem - 5`.0";
          #remove the duration from the list of files
          files=`echo $files | sed 's/^\<[^ ]*\>//'`;
        fi
        if [ "$files" = "" ]; then
          echo "You must enter image files to associate with the XML file";
        else
          for file in $files
          do
            if [ ! -f $file ]; then
    	  echo "\"$file\" does not exist";
    	  inputIsValid="";
            elif [ "`echo $file | sed 's/^.*\.\(jpg\|jpeg\|bmp\|png\|gif\|tif\|tiff\|jif\|jfif\|jp2\|jpx\|j2k\|j2c\)$//'`" != "" ]; then
    	  echo "\"$file\" is not an image file";
    	  inputIsValid="";
    	fi
          done
          if [ $inputIsValid ]; then
            currDir=`pwd`;
            echo "<background>" >> $xmlfile
            echo "  <starttime>\n    <year>2009</year>\n    <month>08</month>\n    <day>04</day>" >> $xmlfile;
            echo "    <hour>00</hour>\n    <minute>00</minute>\n    <second>00</second>\n  </starttime>" >> $xmlfile;
            echo "  <!-- This animation will start at midnight. -->" >> $xmlfile;
            firstFile=`echo $files | cut -d " " -f 1`;#grab the first item
            if [ "`echo $firstFile | sed 's/\(.\).*/\1/'`" != "/" ]; then
              #If the first character in the filename is not '/', then it is a relative path and must have the current directory's path appended
              firstFile="$currDir/$firstFile";
            fi
            firstFile=`echo $firstFile | sed 's/[^/]\+\/\.\.\/\?//g'`;#Remove occurrences of ".." from the filepath
            files=`echo $files | sed 's/^\<[^ ]*\>//'`;#remove the first item
            prevFile=$firstFile;
            currFile="";
            #TODO add absolute path to the filenames
            #if $currFile =~ "^/.*" then the file needs to path appended
            echo "  <static>\n    <duration>$duration</duration>\n    <file>$firstFile</file>\n  </static>" >> $xmlfile;
            for currFile in $files
            do
              if [ "`echo $currFile | sed 's/\(.\).*/\1/'`" != "/" ]; then
                #If the first character in the filename is not '/', then it is a relative path and must have the current directory's path appended
                currFile="$currDir/$currFile";
              fi
              currFile=`echo $currFile | sed 's/[^/]\+\/\.\.\/\?//g'`;#Remove occurrences of ".." from the filepath
              echo "  <transition>\n    <duration>5.0</duration>\n    <from>$prevFile</from>\n    <to>$currFile</to>\n  </transition>" >> $xmlfile;
              echo "  <static>\n    <duration>$duration</duration>\n    <file>$currFile</file>\n  </static>" >> $xmlfile;
              prevFile=$currFile;
            done
            echo "  <transition>\n    <duration>5.0</duration>\n    <from>$currFile</from>\n    <to>$firstFile</to>\n  </transition>" >> $xmlfile;
            echo "</background>" >> $xmlfile;
          fi
        fi
      fi
    fi

  6. #6
    Join Date
    Sep 1999
    Posts
    3,202
    I'm using a cron job and a simple shell script to delete my wallpaper file and copy a random one to the same file name every minute. Works fine.

  7. #7
    Join Date
    Jan 2003
    Location
    Austin, Texas
    Posts
    683
    Heh...you folks realize this thread is over 7 years old right?
    "The author of that poem is either Homer or, if not Homer, somebody else of the same name."

  8. #8
    Join Date
    Jul 2001
    Location
    UK
    Posts
    316
    Now It's got me trying to remember when I first used chbg, I know I had XScreensaver hacks as a background in '03...
    We are free to think. We are free to plan. And we are free to do. But once an action has been taken, we are never free from its consequences.
    --Russel M. Nelson, apostle.

Posting Permissions

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