Last active
August 29, 2015 14:06
-
-
Save dbehnke/3f5fc9e9716f0f5464fd to your computer and use it in GitHub Desktop.
wallpaper changer for Gnome3 (tested on gnome 3.12)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import time | |
import subprocess | |
random.seed() | |
full_files = [] | |
rootdir = "/home/dbehnke/wallpapers" | |
sleeptime = 300 | |
while 1: | |
print("reading pictures from ", rootdir) | |
for root, subdirs, files in os.walk(rootdir): | |
for file in files: | |
if file.endswith(".jpg"): | |
full_files.append(os.path.join(root, file)) | |
if file.endswith(".png"): | |
full_files.append(os.path.join(root, file)) | |
random.shuffle(full_files) | |
i = 0 | |
for file in full_files: | |
i += 1 | |
print("#%d %s" % (i, file)) | |
i = 0 | |
for file in full_files: | |
i += 1 | |
print("changing picture to %d of %d - %s" % (i, len(full_files), file)) | |
subprocess.call(['gsettings', 'set', 'org.gnome.desktop.background', | |
'picture-uri', file]) | |
time.sleep(sleeptime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment