tangled
alpha
login
or
join now
m1emi1em.dev
/
bb-scripts
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
feat: add grimblastr
m1emi1em.dev
11 months ago
733e00ae
ad75e97f
+30
1 changed file
expand all
collapse all
unified
split
grimblastr
grimblastr.bb
+30
grimblastr/grimblastr.bb
···
1
1
+
#!/usr/bin/env bb
2
2
+
;;; wofi wrapper for grimblast
3
3
+
(require '[babashka.process :refer [shell]]
4
4
+
'[clojure.string :as str])
5
5
+
6
6
+
(def menus [["copysave"
7
7
+
"copy"
8
8
+
"save"
9
9
+
"edit"]
10
10
+
11
11
+
["area"
12
12
+
"active"
13
13
+
"screen"
14
14
+
"output"]])
15
15
+
16
16
+
(defn run-dmenu! [list-items]
17
17
+
(let [stdin (str/join "\n" list-items)]
18
18
+
(shell {:out :string :in stdin}
19
19
+
"wofi --show dmenu")))
20
20
+
21
21
+
(def do-dmenu! (comp str/trim :out run-dmenu!))
22
22
+
23
23
+
(defn main [& args]
24
24
+
(try
25
25
+
(let [[command target] (map do-dmenu! menus)]
26
26
+
(shell "grimblast" command target))
27
27
+
(catch Exception e)))
28
28
+
29
29
+
(when (= *file* (System/getProperty "babashka.file"))
30
30
+
(apply main *command-line-args*))