summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblack <dylan.araps@gmail.com>2019-04-30 12:05:19 +0300
committerGitHub <noreply@github.com>2019-04-30 12:05:19 +0300
commit3cedb38053b9c2b32665fc1485963cee652af341 (patch)
tree31debe0cc0742ce796fc48b73811b84534a45045
parente7d956ca18c72f52dd6c5f5c2e606d287d025723 (diff)
parent2f3a492ed2d464c8be2835473c4c91af6301e5f1 (diff)
Merge pull request #395 from ellisgeek/master
Add support for setting wallpaper in xfce > 4.12
-rw-r--r--pywal/wallpaper.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py
index e711713..e9fa23e 100644
--- a/pywal/wallpaper.py
+++ b/pywal/wallpaper.py
@@ -2,6 +2,7 @@
import ctypes
import logging
import os
+import re
import shutil
import subprocess
import urllib.parse
@@ -39,10 +40,21 @@ def get_desktop_env():
return None
-def xfconf(path, img):
+def xfconf(img):
"""Call xfconf to set the wallpaper on XFCE."""
- util.disown(["xfconf-query", "--channel", "xfce4-desktop",
- "--property", path, "--set", img])
+ xfconf_re = re.compile(
+ r"^/backdrop/screen\d/monitor(?:0|\w*)/"
+ r"(?:(?:image-path|last-image)|workspace\d/last-image)$",
+ flags=re.M
+ )
+ xfconf_data = subprocess.check_output(
+ ["xfconf-query", "--channel", "xfce4-desktop", "--list"],
+ stderr=subprocess.DEVNULL
+ ).decode('utf8')
+ paths = xfconf_re.findall(xfconf_data)
+ for path in paths:
+ util.disown(["xfconf-query", "--channel", "xfce4-desktop",
+ "--property", path, "--set", img])
def set_wm_wallpaper(img):
@@ -75,9 +87,7 @@ def set_desktop_wallpaper(desktop, img):
desktop = str(desktop).lower()
if "xfce" in desktop or "xubuntu" in desktop:
- # XFCE requires two commands since they differ between versions.
- xfconf("/backdrop/screen0/monitor0/image-path", img)
- xfconf("/backdrop/screen0/monitor0/workspace0/last-image", img)
+ xfconf(img)
elif "muffin" in desktop or "cinnamon" in desktop:
util.disown(["gsettings", "set",