diff options
Diffstat (limited to 'bin/,wallpaper')
| -rwxr-xr-x | bin/,wallpaper | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/,wallpaper b/bin/,wallpaper new file mode 100755 index 0000000..815b036 --- /dev/null +++ b/bin/,wallpaper @@ -0,0 +1,20 @@ +#!/bin/env bb + +(require '[babashka.fs :as fs]) +(require '[babashka.process :refer [shell]]) + +(defn chg-wall [] + (let [wall-dir (str (System/getenv "HOME") "/imagens/wallpapers") + wall (str wall-dir "/wall.png") + session (System/getenv "XDG_SESSION_TYPE") + img (if (fs/exists? wall-dir) + (rand-nth (filter (fn [f] + (not (= f wall))) + (map str (fs/list-dir wall-dir))))) + exec (cond + (= session "wayland") (str (fs/which "swaybg") " -i") + (= session "x11") (str (fs/which "xwallpaper") " --stretch"))] + (fs/copy img wall {:replace-existing true}) + (shell (str exec img)))) + +(chg-wall) |
