King_Critter
By: a guest | Aug 4th, 2009 | Syntax:
Python | Size: 0.58 KB | Hits: 173 | Expires: Never
#!/usr/bin/env python
from easygconf import GConfDict
from daemon import Daemon
import time
import random
import os
gc = GConfDict('/desktop/gnome/background')
dirname = os.path.join(os.path.expanduser("~"), "pics/wallpaper/safe/")
wallpapers = [f for f in os.listdir(dirname)
if os.path.isfile(os.path.join(dirname, f))]
class MyDaemon(Daemon):
def run(self):
while True:
dice = random.randint(0,(len(wallpapers)-1))
gc["picture_filename"] = dirname + wallpapers[dice]
time.sleep(60*5)
daemon = MyDaemon('/tmp/critters-wallpaper-switcher.pid')
daemon.start()