]> git.phdru.name Git - xsetbg.git/blobdiff - xsetbg.py
Feat: Display WEBP images using `display` from ImageMagic
[xsetbg.git] / xsetbg.py
index 68828cf567b5db4c43875df9e5c36b737c02362d..706e183ef2cad8338877b5a6c59bfa04a419c2c5 100644 (file)
--- a/xsetbg.py
+++ b/xsetbg.py
@@ -125,6 +125,16 @@ def change(force=False):
                            "-center", "-onroot", "-quiet", "-zoom", "auto",
                            row.full_name.encode(fs_encoding)]
 
+        ext = os.path.splitext(row.full_name)[1].lower()
+        if ext in ('tif', 'tiff'):
+            program_options[0] = 'xsetbg'
+
+        if ext == 'webp':
+            program_options = ['display', '-backdrop',
+                               '-background', random.choice(borders),
+                               '-window', 'root',
+                               row.full_name.encode(fs_encoding)]
+
         rc = subprocess.call(program_options)
         if rc:
             error("cannot execute xli!")