Demotivation

I recently came across this set of satirical demotivation posters, and rigged my computer to set a random one as my desktop background every time that I log in (yeah, the novelty will surely fade with time). Here’s how.

Just save all the JPEGs (manually or with wget) into one folder, strip the captions if you want (with ImageMagick or PIL – crop the bottom 14 pixels off), save the script below as random_background.py and from System → Preferences → Sessions, go to the Startup Programs tab and add your script.

#!/usr/bin/env python

import gconf, glob, random

all_pics = glob.glob ('/home/yourname/pics/wallpapers/despair/*.jpeg')
pic = random.choice (all_pics)
gconf.client_get_default ().set_string ("/desktop/gnome/background/picture_filename", pic)

Update (2006-02-06): Yeah, the novelty wore off, after a little over a month.