From 20adf692a019da1be01c203764bf287830c93395 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 30 Jun 2017 23:09:06 +1000 Subject: [PATCH] wallpaper: Move function around. --- pywal/wallpaper.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index ded1109..48d4249 100755 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -31,6 +31,28 @@ def xfconf(path, img): "--property", path, "--set", 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_desktop_wallpaper(desktop, img): """Set the wallpaper for the desktop environment.""" desktop = str(desktop).lower() @@ -58,28 +80,6 @@ def set_desktop_wallpaper(desktop, img): 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.""" desktop = get_desktop_env()