#!/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)