aboutsummaryrefslogtreecommitdiff
path: root/wal
diff options
context:
space:
mode:
authorDylan Araps <[email protected]>2017-06-23 13:56:24 +1000
committerDylan Araps <[email protected]>2017-06-23 13:56:24 +1000
commit5481829a1299a7b341254a5875ca3973af3737e2 (patch)
tree98bdb14c539f6a2e164006315c26018b11b4d248 /wal
parentGeneral: Remove requirements.txt (diff)
downloadpywal-5481829a1299a7b341254a5875ca3973af3737e2.tar.xz
pywal-5481829a1299a7b341254a5875ca3973af3737e2.zip
wallpaper: Reduce duplicate code.
Diffstat (limited to 'wal')
-rwxr-xr-xwal25
1 files changed, 12 insertions, 13 deletions
diff --git a/wal b/wal
index 86534bc..c99c9fa 100755
--- a/wal
+++ b/wal
@@ -371,36 +371,35 @@ def get_desktop_env():
return "MATE"
+def xfconf(path, img):
+ """Call xfconf to set the wallpaper on XFCE."""
+ subprocess.Popen(["xfconf-query", "--channel", "xfce4-desktop",
+ "--property", path, "--set", img])
+
+
def set_desktop_wallpaper(desktop, img):
"""Set the wallpaper for the desktop environment."""
desktop = str(desktop).lower()
if "xfce" in desktop or "xubuntu" in desktop:
- subprocess.Popen(["xfconf-query", "--channel", "xfce4-desktop",
- "--property",
- "/backdrop/screen0/monitor0/image-path",
- "--set", img])
-
# XFCE requires two commands since they differ between versions.
- subprocess.Popen(["xfconf-query", "--channel", "xfce4-desktop",
- "--property",
- "/backdrop/screen0/monitor0/workspace0/last-image",
- "--set", img])
+ xfconf("/backdrop/screen0/monitor0/image-path", img)
+ xfconf("/backdrop/screen0/monitor0/workspace0/last-image", img)
elif "muffin" in desktop or "cinnamon" in desktop:
subprocess.Popen(["gsettings", "set",
"org.cinnamon.desktop.background",
"picture-uri", "file:///" + img])
- elif "mate" in desktop:
- subprocess.Popen(["gsettings", "set", "org.mate.background",
- "picture-filename", img])
-
elif "gnome" in desktop:
subprocess.Popen(["gsettings", "set",
"org.gnome.desktop.background",
"picture-uri", "file:///" + img])
+ elif "mate" in desktop:
+ subprocess.Popen(["gsettings", "set", "org.mate.background",
+ "picture-filename", img])
+
def set_wallpaper(img):
"""Set the wallpaper."""