Home > Cobber, Gnome, MATE, Tutorial > Tutorial: How to make a background slideshow (MATE)

Tutorial: How to make a background slideshow (MATE)

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 the old Gnome 2 desktop environment and I have it working on MATE. 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 Gnome 2 and MATE.

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. Please do not turn this tutorial into a “my way is the best way” discussion, instead treat it like the technical tutorial it is.
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 Pluma file (Gedit in Gnome) and save 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 Pluma 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 Pluma to change bulk entries to something else. So while you have it open in Pluma 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 need to 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.  Instead of changing each one individually you can use a bulk change to do 3 at a time. So in Pluma 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.

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 using su or sudo as required

Code:
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.

Now you have made you own background slideshow why don’t you make your own screensaver.

n.b. This tutorial is posted in a few places on the net, I originally posted it on Ubuntu forums when I was an Ubuntu user. I then posted it in what was called Open Ubuntu Forum. Because I have no control over forums (Ubuntu forums were talking about getting rid of old posts at one stage) I have decided to post tutorials I have written on my own blog. At least that way I know they are still around for people to use if they so wish.

About these ads
Categories: Cobber, Gnome, MATE, Tutorial
  1. February 16, 2013 at 4:25 am

    Very nice tutorial!

    I wrote a python script to automate the XML generation using a folder with the images to cycle.

    You can get the script on my repository on github: https://github.com/alexandrefvb/mate-cycle-backgrounds

    Thanks for the information!

  2. February 16, 2013 at 6:02 pm

    Thanks Alexandrefvb, any help is always greatly appreciated.

    Cheers.

  3. Robert
    April 22, 2013 at 5:19 am

    Excellent tutorial – but one suggestion: Make it clear that the images need to be resaved and any metadata (I think) removed (for some reason I had to a lot of trouble getting this to work because of the images not getting recognized). Other than that though, this tutorial is right on the money. Thanks!

    • April 22, 2013 at 3:08 pm

      Hi Robert, as mentioned in the MATE forums where you also posted this, I have never had anyone here or in other places this tutorial has been posted have a problem related to metadata.

      • Robert
        April 22, 2013 at 4:14 pm

        I have a hunch you’re probably right, I’m not sure what the actual cause is, as I indicated after metadata above (saying ‘I think’ :)). (I made the post on the MATE forums so that it would help save other people the frustration).

        Basically, what I had tried to do was to use a handful of images I’ve been using already as backgrounds to make the slideshow (of course making copies of them and putting them in a new folder as the instructions indicated). Well, before reformatting them they were coming out all black – literally (and the files themselves had the ‘x’ emblems in caja (as a superuser no less) instead of thumbnails, which I also thought was odd).

        Anyway, hopefully that’s a good start as to information on this – perhaps we can figure out why I was having to resave – it’s really pretty weird since it’s so simple and straight forward a process, really.

      • April 22, 2013 at 4:23 pm

        I have a heap of digital photographs given to me for backgrounds so once I have some more time I’ll look into that. I’m wondering if the change to MATE 1.6 has anything to do with it?

  4. Robert
    April 22, 2013 at 4:25 pm

    I don’t think so. As I got most of these images from the web, I think there might have been some digital restrictions on them, or something, because some of them I had to straight up convert from jpg to png – :|

  5. March 24, 2014 at 2:56 pm

    I have see that you can specify the transition type (i.e.: ). Do you know which are the other supported types?

    • March 24, 2014 at 4:23 pm

      Hi Guillermo
      The transition isn’t actually a type but rather how long it takes. As standard transition is 5 seconds.

  1. October 6, 2012 at 11:04 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: