Day 8: update_gnome_wallpaper
This script will randomly select an image file from a folder of files and update the wallpaper in ubuntu
import os,random
import constants
WALLPAPER_DIR= constants.WALLPAPER_DIR # Wallpaper Location
images=[item for item in os.listdir(WALLPAPER_DIR) if os.path.isfile(os.path.join(WALLPAPER_DIR,item)) and item.split(".")[-1].lower() in ["png",'jpg']]
if len(images) >0:
wallpaper=random.choice(images)
os.system("gsettings set org.gnome.desktop.background picture-uri file://"+os.path.join(WALLPAPER_DIR,wallpaper))
Please Visit my Git Repo to check out all the previous day challenges.
Top comments (0)