Add rofi example [skip ci] (#651)
Rofi is a linux modal menu for fuzzy filtering, with a similar UX to Alfred or Spotlight on OSX. Borrows quite directly from the fzf example.
This commit is contained in:
parent
14f452a904
commit
8da8b3ffb8
2 changed files with 25 additions and 1 deletions
|
|
@ -369,3 +369,15 @@ Example usage:
|
|||
``` shell
|
||||
$ cat src/babashka/main.clj | bb examples/fzf.clj
|
||||
```
|
||||
|
||||
### [rofi](rofi.clj)
|
||||
|
||||
Invoke [rofi](https://github.com/davatorium/rofi), a type-to-filter menu on linux, from babashka.
|
||||
|
||||
See [rofi.clj](rofi.clj)
|
||||
|
||||
Example usage:
|
||||
|
||||
``` shell
|
||||
$ cat src/babashka/main.clj | bb examples/rofi.clj
|
||||
```
|
||||
|
|
|
|||
12
examples/rofi.clj
Normal file
12
examples/rofi.clj
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(require '[babashka.process :as p])
|
||||
|
||||
(defn rofi [s]
|
||||
(let [proc (p/process
|
||||
["rofi" "-i" "-dmenu" "-mesg" "Select" "-sync" "-p" "*"]
|
||||
{:in s :err :inherit
|
||||
:out :string})]
|
||||
(:out @proc)))
|
||||
|
||||
(rofi (slurp *in*))
|
||||
|
||||
;; `echo "hi\nthere\nclj" | bb examples/rofi.clj`
|
||||
Loading…
Reference in a new issue