Results 1 to 10 of 48

Thread: HowTo: Create a background slideshow.

Threaded View

  1. #1
    Join Date
    Oct 2007
    Location
    Australia
    Beans
    1,715
    Distro
    Ubuntu Development Release

    HowTo: Create a background slideshow using what is already installed on your machine.

    HowTo: Create a background slideshow using what is already installed on your machine.

    What's the point of this tutorial?

    This tutorial is it is here for those who wish to work with what is already installed on their system and wish to have a screen background that changes at predetermined intervals. It is for those who want to understand the already natively available AND installed system. It has been tested on Ubuntu 10.04 Lucid Lynx which is the current LTS. I will not, because I don't have any earlier versions installed anymore, be testing this on anything prior to Ubuntu 10.04. As each new version is released I will test it and report any difficulties found. If you have difficulties please feel free to let me know what they are and we can work through them together. It is based on the script and setup for the background named "Cosmos" which comes pre-installed in Ubuntu 10.04.

    Please note: This is just 1 way of doing this, there are many more ways and formats possible. Choose what is the best for you. This tutorial isn't here to dictate to anyone what is the best method for you to use. Instead, as has already been stated, it is here for those who wish to work with what is already installed on their system. If you find something others can use you could create a Tutorial on it to help others. Please do not turn this tutorial into a "my way is the best way" discussion, instead treat it like the technical tutorial it is and leave discussion about other methods to other threads.

    Note: I do not know if this will work in Kubuntu, Xubuntu, or any other variant other than Ubuntu. IF you try this in anything other than Ubuntu 10.04 and it works please let us know so we can add the information to this thread and give you the credit for your hard work in testing this in an untested variant.

    TheSqueak has explained how to get this working in Kubuntu. Thanks TheSqueak

    Punkphysicist reports that it works in 10.10 (Maverick). Thanks Punkphysicist.

    Lets start

    1. What do we need to make a changing background?

    You will need a Folder for your background, an XML file that tells your computer what pictures to use in what order and how long to use them for (it is below so feel free to copy and past this into a new Gedit file and sav it with a descriptive name like lotr.xml, you must put .xml after the name). You will also need at least 2 pictures (I use jpg format pictures because I know they work) preferably of a decent size so the image is crisp and clear on your screen.

    2. Create a Folder.

    Now that you have the generic XML file from this thread and have chosen the pictures you want to use we need to create a folder to put everything in.

    To do this go to Places > Home Folder and open your Home folder. When your Home folder opens go to File > Create Folder and click Create Folder. This will create a folder called "Untitled Folder" which you can call anything you want. I created my folder and called it lotr (i.e. Lord Of The Rings).

    3. Setting up the folder.

    OK, now we have our folder we need to copy everything into it. Now you can either cut and paste or copy and paste. If you cut and paste you will actually move the files from where they are now to your new folder. If you copy and paste you will still have your original files PLUS a copy in your new folder.

    4. Setting up the Generic XML file.

    So far we have all the things we need and have them placed in their own folder but nothing will happen until we tell the Computer what to do with it. This is when we start doing this.

    Open the Generic XML file with Gedit so we can modify it to suit our purpose.

    The generic XML looks like this

    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/yourfoldername/yourpicturename1.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/yourfoldername/yourpicturename1.jpg</from>
    <to>/usr/share/backgrounds/yourfoldername/yourpicturename2.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/yourfoldername/yourpicturename2.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/yourfoldername/yourpicturename2.jpg</from>
    <to>/usr/share/backgrounds/yourfoldername/yourpicturename3.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/yourfoldername/yourpicturename3.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/yourfoldername/yourpicturename3.jpg</from>
    <to>/usr/share/backgrounds/yourfoldername/yourpicturename4.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/yourfoldername/yourpicturename4.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/yourfoldername/yourpicturename4.jpg</from>
    <to>/usr/share/backgrounds/yourfoldername/yourpicturename5.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/yourfoldername/yourpicturename5.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/yourfoldername/yourpicturename5.jpg</from>
    <to>/usr/share/backgrounds/yourfoldername/yourpicturename6.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/yourfoldername/yourpicturename6.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/yourfoldername/yourpicturename6.jpg</from>
    <to>/usr/share/backgrounds/yourfoldername/yourpicturename1.jpg</to>
    </transition>
    </background>
    Note: I have highlighted "yourfoldername" in Red and "yourpicturename1" in YellowGreen with each successive "yourpicturename(2-3-4-5-6)" in different colour for each number. There is an easy way in Gedit to change bulk entries to something else. So while you have it open in Gedit go to Search > Replace and click Replace, when the dialogue box comes up type in "yourfoldername" without the quotes in the Search for: entry box and then type the name of your own folder (in my case it was "lotr") in the Replace with: dialogue box. Now click "Replace All" and every instance of "yourfoldername" will be changed with the name of your folder (e.g. "lotr").

    Now the next bit isn't as easy, sorry . You will have to manually change each "yourpicturename" to the name of your chosen pictures. Why? did I hear you ask? Well basically because you will only have 3 entries with each name. Please take a look at my own "lotr.xml" to see what I mean.

    Edit: I have made a slight change to make it a little easier with bulk changing the yourpicturename title. Instead of changing each one individually you can now use a bulk change to do 3 at a time. So in Gedit choose Search > Replace and type in yourpicturename1 and change it to the picture you want to start with, then go Search > Replace and type in yourpicturename2 and type in the name of the 2nd picture. Just keep doing this till you are finished.

    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/lotr/Aragorn_1024x768.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/lotr/Aragorn_1024x768.jpg</from>
    <to>/usr/share/backgrounds/lotr/Arwen_1024x768.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/lotr/Arwen_1024x768.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/lotr/Arwen_1024x768.jpg</from>
    <to>/usr/share/backgrounds/lotr/Epic_1024x768.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/lotr/Epic_1024x768.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/lotr/Epic_1024x768.jpg</from>
    <to>/usr/share/backgrounds/lotr/Frodo_1024x768.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/lotr/Frodo_1024x768.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/lotr/Frodo_1024x768.jpg</from>
    <to>/usr/share/backgrounds/lotr/Gandalf_1024x768.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/lotr/Gandalf_1024x768.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/lotr/Gandalf_1024x768.jpg</from>
    <to>/usr/share/backgrounds/lotr/Sam_1024x768.jpg</to>
    </transition>
    −
    <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/lotr/Sam_1024x768.jpg</file>
    </static>
    −
    <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/lotr/Sam_1024x768.jpg</from>
    <to>/usr/share/backgrounds/lotr/Aragorn_1024x768.jpg</to>
    </transition>
    </background>
    Please make sure you note that Aragorn is the first 2 and the the last entry. The rest are all consecutive and replace 3 "yourpicturename" entries. You must do it this way so that the background cycles through the pictures.

    EDIT:yaaarrrgg has come up with script to create the xml file.

    EDIT: bebopiiam has also developed a script to do much of the work for you.

    Now you have 3 methods to do it the Ubuntu way.

    5. What does all the code mean?

    For our purposes we only need to worry about the bits that actually deal with the pictures so in order of occurrence we have
    <static> Means the picture that is currently on the screen,
    <duration>1795.0</duration> How long will it stay for. This is in seconds so 1795.0 seconds is approximately 30 minutes. If you want a shorter "static" period just change it to the number of seconds you would like (e.g. 600 seconds is 10 minutes).
    <file>/usr/share/backgrounds/lotr/Aragorn_1024x768.jpg</file> The location and name of the picture file.
    </static> The picture currently on the screen.

    <transition> This is when the pictures change.
    <duration>5.0</duration> How long does the change take. I find it is best to leave this alone.
    <from>/usr/share/backgrounds/lotr/Aragorn_1024x768.jpg</from> The location and name of the picture that was on the screen
    <to>/usr/share/backgrounds/lotr/Arwen_1024x768.jpg</to> The location and nam of the picture that will be on the screen
    </transition> End of transition cycle.

    <static> The new picture on the screen
    <duration>1795.0</duration> How long it will be there for.
    <file>/usr/share/backgrounds/lotr/Arwen_1024x768.jpg</file> Name and location of the picture.
    </static> The picture on the screen.


    6. Finishing the setup


    Now that we have our folder, which includes the pictures and XML file, setup and we have modified the XML file to suit we need to put it in the right place so it can all work.

    My advice is to copy and paste (not cut and paste)the folder and its contents to /usr/share/backgrounds. To do this we need to open a terminal so go to Applications > Accessories > Terminal and copy and paste this in.

    Code:
    sudo cp /home/YOURUSERNAME/PathToYourFolder /usr/share/backgrounds
    changing YOURUSERNAME to your actual user name and PathToYourFolder to the actual folder name you gave when we first started. Tap enter, type in your password, and if everything goes well it should copy your folder over for you.

    Now go to System > Preferences > Appearance and click appearance. When the Appearance Preferences dialogue box open click on the "Background" tab. Now we are in the "Background" tab look at the bottom and click on "Add". This will open another dialogue box. Navigate to the folder you have setup and you should see the picture files listed. If you don't see the XML file listed you will need to go to the bottom of the dialogue box and where it has "Images" and a drop down arrow change that to "All Files". You should now be able to select your XML file. Once you have done that you can select your new background image selection in the System > Preferences > Appearance dialogue.

    Test it out and let us know how you go.

    If you have any hints or suggestions regarding this format please feel free to make them and I will adjust this post accordingly.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	CreateFolder.png 
Views:	98 
Size:	175.6 KB 
ID:	156270   Click image for larger version. 

Name:	lotr1.png 
Views:	86 
Size:	178.2 KB 
ID:	156271   Click image for larger version. 

Name:	UntitledFolder.png 
Views:	76 
Size:	179.2 KB 
ID:	156272   Click image for larger version. 

Name:	Gedit1.png 
Views:	85 
Size:	163.0 KB 
ID:	156273  
    Last edited by k3lt01; March 17th, 2011 at 09:09 AM.
    Ubuntu User 23142 | Wiki | Laptop | HowTo:Create a background slideshow and Screensaver | Reconditioning pre-loved PCs and installing Ubuntu to give away to good homes.

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
  •