1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
import subprocess, os, random, time

#~~~~~~~~~~~~~~~~ hackersforcharity.org ~~~~~~~~~~~~~~~~#

WALLPAPERS_DIR = "/home/unknown/Pictures/Wallpapers"    #Directory where your wallpapers are saved (don't put the ending '/')
DELAY = 1                                               #Delay in minutes before the wallpaper changes

##################################~ YEARGH FUNCTION STUFF BELOW ~####################################################

def change_wallpaper(file):
        args = ["/usr/bin/gsettings", "set", "org.gnome.desktop.background", "picture-uri", "file://"+WALLPAPERS_DIR+"/"+file]
        subprocess.check_call(args)

while True:
        picsList = os.listdir(WALLPAPERS_DIR)
        random.shuffle(picsList)
        change_wallpaper(picsList[0])
        time.sleep(DELAY*60)