View Single Post
Posts: 992 | Thanked: 738 times | Joined on Jun 2010 @ Low Earth Orbit
#3
I have just recently perfected my auto desktop wallpaper changer. It runs off QBW.

Here's the python script that does the heavy lifting:

Code:
#!/usr/bin/python

import glob, random, shlex, subprocess
debug = 0

desktops = [1, 2, 3, 4]
file_extensions = ['jpg', 'tif', 'png']
image_dir = "/media/mmc1/DCIM/"

images = []
for current_file_extension in file_extensions:
        images = images + glob.glob(image_dir + '*.' + current_file_extension)
        images = images + glob.glob(image_dir + '*/*.' + current_file_extension)
if debug:
        print images
for current_desktop in desktops:
        new_image = images[random.randint(1, len(images)) - 1]
        cmd = "gconftool-2 --type string --set /apps/osso/hildon-desktop/views/%d/bg-image '%s'" % (current_desktop, new_image)
        if debug:
                print cmd
        args = shlex.split(cmd)
        if debug:
                print args
        subprocess.Popen(args)
The things that you can set are highlighted above:

desktops = list of desktops that you want to change
image_dir = the full path to a directory where your images are stored
file_extensions = extensions which indicate an image file (note it's case-sensitive)
 

The Following 6 Users Say Thank You to kureyon For This Useful Post: