Skip to content

Instantly share code, notes, and snippets.

@krishnachaitanya7
Last active July 30, 2017 09:08
Show Gist options
  • Save krishnachaitanya7/64ab1a2633239456dbe7 to your computer and use it in GitHub Desktop.
Save krishnachaitanya7/64ab1a2633239456dbe7 to your computer and use it in GitHub Desktop.
#directions to use- place this python file in a folder containing wallpapers and run the python code. That's it. and importantly #run the code as non-sudo user!
#directions to use- place this python file in a folder containing wallpapers and run the python code. Thats it. and importantly #run the code as non-sudo user!
#/usr/bin/env python
import os
from subprocess import call
import glob
import time
wall_change_time = 10
def set_wallpaper(image_file_with_path):
filepath = os.path.abspath(image_file_with_path)
call(['gsettings', 'set', 'org.gnome.desktop.background', 'picture-uri', 'file://%s' % (filepath)])
return True
#while os.geteuid() == 0:
while(1):
for file_jpg in glob.glob("*.jpg"):
print("your desktop background will be changing.")
set_wallpaper(file_jpg)
time.sleep(wall_change_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment