Tuesday, November 24, 2009

Create Your Own GNOME Background Slideshow

One of the cool new features in the fresh GNOME 2.28 desktop environment is the ability to use a set of multiple images as your background, images that will transition between eachother at set timeframes. Unfortunately, as far as I know, there's not an easy, in plain view, way of creating your own sets, with your own pictures.



So, I tried to find out how they were created by going to their source directory, which is /usr/share/backgrounds. All the wallpapers were there, but the Cosmos set had a separate directory, as I was expecting. Inside are, obviously, all the pictures that will loop on your desktop once you activate the set, but the key piece of our little puzzle has to be the background-1.xml file. Before we begin editing it we need to operate as root within the folder. To do that, simply open a Terminal, type sudo nautilus, enter your password and a new folder window called root will pop up in a few moments.

Now click on "File System" on the left, navigate to the /usr/share/backgrounds directory and create a new folder. Don't forget to name it according to whatever theme your pictures might have, in my case, "jewel". Proceed inside the folder (sounds fancy, right? :D ) and leave the window open as it is.

The next step is to select the pictures that you want included in the set and copy them. You don't need to open another root nautilus, simply navigate to your pictures directory as you normally do, select the files and copy them. Go back to the administrator-ran "jewel" directory and paste those babies in there.

What's missing now is the xml file to tell GNOME how to handle the images. A bit of a disclaimer first: I know NOTHING about programming, advanced web design or any other thing that has to do with coding. With that out of the way, it's obvious that I stole the background-1.xml file from the "cosmos" folder that was already in there. Go up a level, copy it, go back to your folder, paste it, and rename it to, say... background-2! Thumbs up! :D

What you need to do next is open the file in your favorite text editor. I use gedit, so right click on the file, select "open with" and gedit. I didn't want to mess with the transition speed settings, so it's best to leave them untouched. What we need to change are only the paths to the images. There are two sections for each image: static and transition. In the first static section, replace the path right next to with the path to your first image. To easily copy a path, right click on an image, go to Properties and there it is, in the Location field. You will only need to replace the filename manually. In my case, I replaced this line: /usr/share/backgrounds/cosmos/cloud.jpg with this line: /usr/share/backgrounds/jewel/jewel-01.JPG. In the transition section, you can see that there are two paths, one that leads to the first image and the other that leads to the next image in the set. This part instructs GNOME to transition between the first and the second image in your set. The next section is again, a static one, in which you need to type the path to the second image. The following, "transition" section needs the paths to the second and third image. Hope you're still with me here! :) Now go on replacing the paths until you run out of images. Be careful though, the last section, before the line, has to be a transition between the last image in your set and the FIRST one, so it can loop. You can then remove the extra sections. Sections begin with either or and end with or .

Very important! Be very careful with lower, upper-case characters. Be sure to write the filenames exactly as they are in your folder. I was quite dazzled on why my xml won't work until I realized my images had a .JPG extenstion instead of .jpg. :)

Now save the XML file, right click on your desktop, go to "Change desktop background" and simply drag the XML file inside the Background window. You can also click the "Add" button, select "All files" right above the "Open" button and navigate to the XML file and open it.

A picture is worth 1000 words, right? Well, in this case, the following 15 FPS video is worth 3975000 words! So, instead of having a picture for every step described above, here's a video! I don't even know why I bothered to write the whole thing. Oh well... :) Enjoy!


So... that's pretty much it, folks! Have a great day and come back! I will try to post more than one article/light year from now on. :)

UPDATE 08.12.2009

Ah... the beauty of Linux... I was almost certain that there would be an easier way to flip through a bunch of wallpapers in GNOME. How right I was. The awesome Linux Journal's Shawn Powers posted a "Tech Tip of the Day" showing off a program called Drapes that does just that. So, without further ado, here's the video:








UPDATE 02.07.2010

Ah... the beauty of Linux... I really have to express that feeling of admiration yet again, as one of my readers have created THIS awesome piece of automaton. You just input the path to your pictures, a delay time and the script does its magic, creating a fully functional XML file which works just like the one you would modify by following my tutorial. Thank you very much, Mr. Mike. The Force of Open Source is definitely strong in you. :D