Skip to content

Instantly share code, notes, and snippets.

@lucivaldo
Last active March 17, 2023 15:35
Show Gist options
  • Save lucivaldo/0fc5167e245d5eea2d975c01aa3cec7f to your computer and use it in GitHub Desktop.
Save lucivaldo/0fc5167e245d5eea2d975c01aa3cec7f to your computer and use it in GitHub Desktop.
Script Python para alterar o wallpaper
#!/usr/bin/env python3
import glob
import os
import random
import time
PICTURES_PATH = os.path.join(os.path.expanduser("~"), "Pictures")
WALLPAPERS_PATH = os.path.join(PICTURES_PATH, "Wallpapers")
while True:
wallpapers = glob.glob(WALLPAPERS_PATH + "/**/*", recursive=True)
wallpaper = random.choice(wallpapers)
if os.path.isfile(wallpaper):
command = "gsettings set org.gnome.desktop.background picture-uri \"{}\"".format(wallpaper)
os.system(command)
time.sleep(300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment