jump to navigation

Random Wallpaper in Gnome December 1, 2005

Posted by Carthik in guides, ubuntu.

I am a wallpaper/background packrat with over a Gigabyte of wallpapers. Now the problem was that there is no in-built mode in Gnome to use a random wallpaper from among the wallpapers in a directory. In looking around, though, I found a few scripts and tools that make this very easy. These tools help you to “rotate” a set of backgrounds, displaying one of many wallpapers at random on your desktop. You can set these to change the wallpaper at various times, or at log-on time.

Here is a summary of the tools and scripts for other folks looking for a random gnome background changer:

Change Wallpaper from Gnome Hacks : This one can use a random image from a folder you specify or download random wallpapers on the fly from the art.gnome.org website and use that, or specify a folder full of images. You can add the script to be run at session startup.

Davyd’s Python Script : Short and sweet python script – picks images from a folder/directory. Needs cronjob.

Richi’s adaptation that uses the .gnome2/backgrounds.xml file: An adaptation of Davyd’s script that changes the wallpaper by editing the .gnome2/backgrounds.xml file. Different strokes for different folks!

Tomasz’ Random Wallpaper Changer: Choice is great! One more variation on the theme.

Gnome Background Changer: It uses the picture list defined in “Change Desktop Background / Desktop Background Preferences” dialog (in ~/.gnome2/backgrounds.xml) or you can specify a directory with pictures in it. You can define how long a picture will be shown before the background is changed. This script is made to run in the background indefinitely (until you log out), so it should be put into the background when started from the shell (gbchange &) or better be started from GNOME’s session management.

You can also use $sudo apt-get install wallpaper-tray to install a wallpaper changer from the command line. This will install wallpaper tray, but be warned it does not work too well with Edgy.

If you need the background changed each time you start a new session (that is, log on, for us non-geek folks), then use a script from above, and add it, after you have edited it to add the right directory etc, and ensuring it works to “System->Preferences->Sessions->Startup Programs”, and you’re all set.

I should think the gnome folks should include a tool to use a random background by default. Maybe it is just that none of the gnome desktop maintainers have are addicted to colorful backgrounds yet 😉

Digg this articleDigg This!


1. Chris Daniel - December 2, 2005

I seem to remember another- it puts a thumbnail of a wallpaper in your panel, and changes the background at some interval – it was called gdswitcher… something like that. Ring any bells?

2. Chris Daniel - December 2, 2005
3. ubuntonista - December 3, 2005

Chris, that sounds like a wonderful idea, and very useful tool, but it does not work on Ubuntu. I tried installing from source, and using alien to convert the rpm. Looks like some libboost_filesystem.so file cannot be find, which is causing all the problems.

It would be great if there was a ubuntu .deb for that tool.

4. Chris Daniel - December 9, 2005

How odd, I could swear that’s the one I installed on Mom’s computer. I’ll look again and get back to you.

5. Robin - January 5, 2006

I does work in Ubuntu, but you need an older version. I think I found a .deb for it somewhere, probably from Debian, or installed the Debian package from the page, or something like that.

However, now I’m trying to compile it on Fedora 4, with no success. Might just have to go for a script instead.

6. Маниакальный Веблог » Более ?лучайные обои - March 24, 2006

[…] ?о однажды на изве?тном блоге ubuntu.wordpress.com наткнул?? на по?т про ?мену обоев, и решил таки ут?нуть ?ебе один понравивший?? ?криптик. Тот, который оперирует только над обо?ми, выбранными в gnome’ов?кой обойной панельке. […]

7. Peter Murray - April 10, 2006

Here is another version… I don’t have all my pics in a single dir… so this takes the tree of files and pick a random one for the wall paper…

I put this in a file which is executed by .bash_profile so eveytime I open a new shell I get a new background…


# Created by Peter A. Murray
# pick a random jpg for the desktop background.

# choose input tree
export BACKGROUND_DIR=~/Desktop/bild/2005
#export BACKGROUND_DIR=~/Desktop/bild/2006/Winter-Jan

# build up the array
array1=( `find “$BACKGROUND_DIR” -name \*.jpg | tr ‘\n’ ‘ ‘`)

# get a random number less than length of array
let “arrayPos %= $element_count”
# set the background image
/opt/gnome/bin/gconftool-2 -t str -s /desktop/gnome/background/picture_filename “$picToUse”

8. Thierry - June 10, 2006

My prefered and shortest option is:

1) install randomize-lines
2) add the two line in a script
gconftool-2 -t str –set /desktop/gnome/background/picture_filename “`find /home/thierry/MesDocuments/Mes\ images/Photos -name \*.jpg | rl -c 1`”
gconftool-2 -t str –set /desktop/gnome/background/picture_options “scaled”
3) launch the script via Gnome Session properties (once at each boot), or launch the script via crontab.

9. motagua - June 16, 2006

You can use apt-get to install wallpaper-tray

10. serious sam - August 14, 2006

Personally I could use pointers on how to install / cron
Otherwinse, excellent

11. yubbin - January 24, 2007

wallpaper-tray in ubuntu is glade-broked, at the moment. use gconf-editor to update the xml file and you’re golden.

12. nick - March 12, 2007

this is a great tutorial/script for changing wallpapers:
recursive folders, options for zooming/filling/tiling/exclusion. good stuff

13. Peter - March 13, 2007

“Change Wallpaper from Gnome Hacks” is the same link as “Linux Desktop Hacks changer”!!

14. carthik - March 13, 2007

Peter, thanks for catching that – I fixed it – I suspect it was two different things, but I messed up copying the URL – in any case, there is only one now.

15. Beachbum - March 15, 2007

Is there a shell script that would display random desktop backgrounds with a “fade” transition between them, similar to the one that comes with OS X?


16. Blake - April 10, 2007

Hey thanks!

17. TaJMoX - April 11, 2007

Out of the ones you listed, I found Richi’s script to be the best for me.

18. David - September 10, 2007

I downloaded a Python script long time ago and modified it to make it a bit cleaner and more useful (sorry, original copyright text lost). It can now also show digital camera raw files by creating a ppm on the fly using dcraw in /tmp. NEF’s only for now, but should be really easy to change …
Don’t know anything about Python, so might not be really optimized 🙂

# wallpaper.py
# A script to change your gnome wallpaper to a random background image

import gconf
import os
import sys
import random
import mimetypes
import time


# Build a list of all picture files
for rootdir,dirlist,filelist in os.walk(sys.argv[1]): # recursive scan for filenames
for file in filelist:
# Check for NEF first
if (file.endswith(‘.nef’) or file.endswith(‘.NEF’)):
if mimetype and mimetype.split(‘/’)[0]==”image”:
if len(imageitems)”+tempfile)

19. knarf - September 16, 2007

gconftool-2 -t string -s /desktop/gnome/background/picture_filename $(find /home/knarf/wp -iregex ‘.+\.\(jpe?g\|bmp\|png\|gif\)’ | perl -e ‘@a=;print $a[rand @a];’)

Just replace “/home/knarf/wp” with your wallpaper folder.

20. Michael - December 19, 2007

After trying all of these approaches, I found “Desktop Drapes” which is installable via apt-get (or the Ubuntu Applications -> Add/Remove menu); it is simple and clean, and rotates my wallpapers. Make sure to select “All available applications” in the Add/Remove dialog, and then search for “drapes” to find it.

21. michael - April 10, 2008
22. RA - May 19, 2008

I’m with fb webilder is a very good way to get a Webshots type background in Linux.

23. Dynamicznie zmieniająca się tapeta w Gnome (i kolejny filmik z desktopem w roli głównej) « UBUNTU-SRUBUNTU - May 28, 2008

[…] o WT, odradzał tę aplikację, dla mnie jednak okazała się idealna. Odsyłam zresztą do tej notki – jest napisana zrozumiale i zawiera przydatne wskazówki dla tapetomaniaków. Tutaj jeszcze o […]

24. Jessi - September 13, 2008

There is a program called drapes that will rotate the background for you. You can set the interval and the directory.

25. Jan - January 9, 2009

Jessi’s suggestion (drapes) was the best solution in my case, as I wanted to use the wallpapers set in the Gnome config panel… Thanks!

26. Sinhalen FOSS » Blog Archive » Bud ගේ නව MacBook හි GNU/Linux අත්දැකීම. - February 3, 2009

[…] webilder wallpaper-tray (package manger වෙතින් ලබා ගන්න) (Gnome Wallpaper මාරු කිරීමට වෙනත් විධි ) […]

27. MaDaPHaKa - March 25, 2009

Jessi you are the best! Drapes works perfectly in my case! Thank you

28. Juggler: Wallpaper switcher that’s worth a damn | The Fresh Perspectives - April 14, 2009

[…] most attuned to exactly what I wanted from a wallpaper switching program was the one called “wallpaper-tray” on Ubuntu. Other than that, it’s been a myriad of lame ducks…most programs try […]

29. zach - August 26, 2009

NetPix 3.5 was programmed on Ubuntu for Ubuntu. It has much more than Webshots, and can convert Webshots. You can even customize it to look like Webshots. NetPix’s help file also provides links to other software which can convert Webshots. You can download the latest release of NetPix 3.5 at


30. brandon - January 11, 2010

Desktop Drapes

31. porno sikiş - September 27, 2010

How odd, I could swear that’s the one I installed on Mom’s computer. I’ll look again and get back to you.

32. sex sikiş - September 28, 2010

You can use apt-get to install wallpaper-tray

33. Will - December 6, 2010

Might want to have a look at Cortina, best wallpaper changer I have used so far. https://help.ubuntu.com/community/Cortina

34. Rotating Gnome backgrounds « The Ubuntu Incident - April 4, 2011

[…] Random Wallpaper in Gnome […]

35. ChadH - June 9, 2011

Массовая рассылка обьявлений на 8 тысяч 795 досок а так же на 43 тысячи закрытых форумов и о ваших сайтах и товарах сразу же узнают сотни тысяч клиентов.- Всего 226 рублей за рассылку. – Качественно.С гарантией..- т. 8-926-685 + 32 – 42 ICQ 568113539 почта: rutop10(собака)mail.ru jm 148

36. PaaulMK - July 26, 2011

Большая подборка голых девочек на любой вкус.

37. webchat - September 11, 2011

Hello there! Do you use Twitter? I’d like to follow you if that would be okay. I’m definitely enjoying your blog and look forward to new updates…

38. wynajem samochodów - May 16, 2014

I’d like to find out more? I’d want to find
out some additional information.

39. clash of clans triche - May 24, 2014

Wow that was unusual. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up.
Grrrr… well I’m not writing all that over again. Regardless, just wanted to say excellent blog!

40. cheap hotels sites - May 30, 2014

you are in reality a excellent webmaster. The website loading
velocity is amazing. It seems that you are doing any unique trick.
Also, The contents are masterwork. you’ve done a wonderful task in this topic!

41. green beans coffee extract - June 16, 2014

I always used to read post in news papers but now as I am a user of internet so from now I am using net
for content, thanks to web.

42. green coffee extract and weight loss - August 17, 2014

Wow, amazing weblog structure! How long have you been running a blog
for? you make running a blog glance easy. The total glance of
your web site is excellent, as well as the content!

43. tiny.cc - August 30, 2014

First of all I would like to say excellent blog!
I had a quick question that I’d like to ask if you do not mind.
I was curious to find out how you center yourself
and clear your head before writing. I’ve had trouble clearing my thoughts in getting my
thoughts out there. I truly do enjoy writing however it
just seems like the first 10 to 15 minutes are generally lost just trying to figure out how to begin. Any ideas or tips?
Many thanks!

44. Ummah Global Relief Facebook - September 19, 2014

Hello, the whole thing is going fine here and ofcourse every
one is sharing information, that’s truly excellent,
keep up writing.

45. insurance - September 19, 2014

always i used to read smaller posts that as well clear their motive, and that is also
happening with this piece of writing which I am reading now.

46. Ummah Global Relief - September 20, 2014

Wonderful items from you, man. I have take into accout your stuff previous
to and you are just extremely magnificent.

I actually like what you’ve bought right here, really like what you’re stating and the best
way during which you are saying it. You are making it entertaining and you still care for to stay it sensible.

I can’t wait to learn much more from you. That is actually a terrific website.

47. hostgator affiliate - September 22, 2014

These can be taken a look at and can be chosen according to an individual’s choices.
Wordpress lets you setup and host your own MLM blog. The
reputation is still wonderful which’s why I feel in time they will certainly
end up being popular.

48. box.Com - October 4, 2014

Link exchange is nothing else except it is simply placing the
other person’s website link on your page at suitable place and other person will also do similar in support of you.

49. Rechtsschutzversicherung Vergleich - October 4, 2014

I’m not that much of a internet reader to be honest but your sites really nice,
keep it up! I’ll go ahead and bookmark your website to come back down the road.
All the best

50. https://www.facebook.com/office2010activator - October 5, 2014

Acer laptops are not cheap and should definitely provide far better quality for that money.

One can take help of Word repair software to recover the inaccessible data from the corrupt.
The Oval Perforated Picnic Table features a durable
thermoplastic coating for its permanent protection against
the elements.

51. работа в интернете без вложений и обмана на дому - May 10, 2015

работа в интернете без вложений и обмана на дому

Random Wallpaper in Gnome | Ubuntu Blog

52. freds garden furniture - November 23, 2015

I always spent my half an hour to read this blog’s articles
every day along with a mug of coffee.

53. Mountain Bikes On Sale At Dicks - August 28, 2017

Mountain Bikes On Sale At Dicks

Random Wallpaper in Gnome | Ubuntu Blog

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: