diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-06-30 11:03:22 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-06-30 11:03:22 +1000 |
| commit | ba29542a2a0a1a7f0f7fad27e3a5b0319e853219 (patch) | |
| tree | c1b4ca24372db913c33e5ea0967d0efa6e045c29 /pywal | |
| parent | 15684c5b109a9618cfcce90d7a92c4d7794a86da (diff) | |
wallpaper: Fix bug with wallpaper not being set. Closes #21
Diffstat (limited to 'pywal')
| -rwxr-xr-x | pywal/wallpaper.py | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index 6cd70b6..ded1109 100755 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -54,6 +54,31 @@ def set_desktop_wallpaper(desktop, img): subprocess.Popen(["gsettings", "set", "org.mate.background", "picture-filename", img]) + else: + set_wm_wallpaper(img) + + +def set_wm_wallpaper(img): + """Set the wallpaper for window manager environments.""" + if shutil.which("feh"): + subprocess.Popen(["feh", "--bg-fill", img]) + + elif shutil.which("nitrogen"): + subprocess.Popen(["nitrogen", "--set-zoom-fill", img]) + + elif shutil.which("bgs"): + subprocess.Popen(["bgs", img]) + + elif shutil.which("hsetroot"): + subprocess.Popen(["hsetroot", "-fill", img]) + + elif shutil.which("habak"): + subprocess.Popen(["habak", "-mS", img]) + + else: + print("error: No wallpaper setter found.") + return + def set_wallpaper(img): """Set the wallpaper.""" @@ -63,24 +88,7 @@ def set_wallpaper(img): set_desktop_wallpaper(desktop, img) else: - if shutil.which("feh"): - subprocess.Popen(["feh", "--bg-fill", img]) - - elif shutil.which("nitrogen"): - subprocess.Popen(["nitrogen", "--set-zoom-fill", img]) - - elif shutil.which("bgs"): - subprocess.Popen(["bgs", img]) - - elif shutil.which("hsetroot"): - subprocess.Popen(["hsetroot", "-fill", img]) - - elif shutil.which("habak"): - subprocess.Popen(["habak", "-mS", img]) - - else: - print("error: No wallpaper setter found.") - return + set_wm_wallpaper(img) print("wallpaper: Set the new wallpaper") return 0 |
