How to make a background slideshow for MATE

Do you know how to do something others don't? Why not write a tutorial to help others learn and put it here?
Post Reply
User avatar
Michael_AU
Site Admin
Posts: 31
Joined: Wed Jun 17, 2015 2:30 pm
Location: NSW Australia
Contact:
Australia

How to make a background slideshow for MATE

Post by Michael_AU » Wed Jul 20, 2016 4:05 pm

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 and also 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. 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: Select all

<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: There is an easy way in Gedit & Pluma to change bulk entries to something else. So while you have it open in Gedit or 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 Gedit or 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: Select all

<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: Select all

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 and I don't know if Open Ubuntu Forums even exist anymore) I have decided to post tutorials I have written on my own blog and here in Cobber Community Forums. At least that way I know they are still around for people to use if they so wish.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest