-
-
Save vpassapera/85ba9e7b7e9321d704274331d66cdb90 to your computer and use it in GitHub Desktop.
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 xml.etree.cElementTree as ET | |
wallpapers = ET.Element("wallpapers") | |
for root, dirs, files in os.walk(os.path.expanduser("~/Pictures")): | |
for file in files: | |
if (file.lower().endswith(('.png', '.jpg', '.jpeg'))): | |
wallpaper = ET.SubElement(wallpapers, "wallpaper") | |
wallpaper.set("deleted", "false") | |
name = ET.SubElement(wallpaper, "name") | |
name.text = file | |
filename = ET.SubElement(wallpaper, "filename") | |
filename.text = os.path.join(root, file) | |
options = ET.SubElement(wallpaper, "options") | |
options.text = "zoom" | |
tree = ET.ElementTree(wallpapers) | |
tree.write(os.path.expanduser("~/.local/share/gnome-background-properties/gnome-backgrounds.xml")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment