View Single Post
Posts: 1,179 | Thanked: 770 times | Joined on Nov 2009
#1944
There is a python script to use QBW to randomly change your desktop wallpaper. The script is below. However, I don't know how to use the script nor even know what python is. I tried entering the script in QBW but get an error message. Tried it in xterm but that didn't work either. Could someone tell me how I implement it.

#!/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)