blob: 815b0364c487dd6f14debb0d2a1d22dab5890340 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)
|