Ubuntu Gnome random wallpapers


gbgchange

I have in excess of 100 wallpapers sitting in the Pictures folder on my main PC. It runs Ubuntu with the Gnome environment and I decided it would be great to have these wallpapers change every 10 minutes on a random basis.

I saw no point in reinventing the wheel, so went looking for scripts and came across several. I decided that gbgchange that can be downloaded from http://www.tu-harburg.de/~psvkv/gbgchange/gbgchange was the one to go for as it was written in Perl and I've been programming in Perl myself for the last ten years. Any problems and I figured I could maybe sort them out. You will need to be running Gnome 2.14 or above and you can check this by selecting About GNOME from the System menu. Hardy Heron, the last LTS was 2.22, so anything from there onwards should be fine. Assuming that your version of Gnome is OK, then you can download the script to your Desktop and make it executable by typing the following into a terminal (Applications->Accessories->Terminal):

cd Desktop chmod 755 gbgchange

Next it will need to be moved to /usr/local/bin and this can be easily achieved by typing the following into the terminal:

sudo mv gbgchange /usr/local/bin

Ubuntu will ask you for your password and then move the file. You will need to have Perl on your machine and it comes with the standard installation. If you want to check it is there then type the following into the terminal and it will return the Perl version number if Perl is installed.

perl -v

You'll also need a Perl package installed called XML::Parser and this is also usually standard in Ubuntu, but it won't hurt to try installing it with the following:

sudo apt-get install libxml-parser-perl

If it's already there then it will tell you and if not then it will install. The last package required, and this one doesn't come as standard, is Gnome2::GConf. To install type the following into the terminal:

sudo apt-get install libgnome2-gconf-perl

Once that's done then we're ready to go. You'll need a folder with your wallpapers in and I keep mine in /home/username/Pictures but it can go anywhere. To test the gbgchanger script I set it to changing the desktop every five minutes. This is done with the -m option which is followed by a space and then the number of minutes before a change. The -f option provides the path and I also used the -a option to stretch the wallpapers to the right size for the screen. So the final command I typed into my terminal was as follows:

gbgchange -a stretched -m 5 -f /home/username/Pictures

Substituting my real username for username of course.


My Ubuntu desktop with the script running on a five minute cycle in the terminal top left ...


... five minutes later ...


... and five minutes more.


The startup menu with yet another wallpaper in the background.

So finally, if that's working for you then you can add the command to the startup items with a change time that suits you. When I first tried this with a value of 10 I was surprised that the wallpaper changed once at boot-up and then stayed as was. I checked what I'd set and discovered that I hadn't left a space between the -m and the 10. Presumably it was reading the 0 as the time delay and 0 must mean don't change. So if you don't want the wallpaper to change other than on start up give 0 a try. Anyway, to set the script to run on bootup you need to open Sessions (System->Preferences->Sessions) and select the Startup programs tab. Select the Add option and fill in the three boxes. I put the name of the script in the top box, the full command line in the second box and a brief description in the third. Save that and after you reboot the script should then be active.

Have fun!