Read wal input file from StumpWM using rofi

This commit is contained in:
Jeremy Dormitzer 2020-03-29 23:52:54 -04:00
parent fac1f72529
commit 26c220f39d

View File

@ -101,6 +101,17 @@
(format nil "SUDO_ASKPASS=~~/bin/stumpwm-sudo.sh sudo -A ~S" ,cmd) (format nil "SUDO_ASKPASS=~~/bin/stumpwm-sudo.sh sudo -A ~S" ,cmd)
,collect-output-p)) ,collect-output-p))
;; Input utilities
(defun rofi-completing-read (prompt completions)
(string-trim '(#\newline)
(run-shell-command
(concatenate 'string
"echo -e "
"'" (format nil "~{~A~^\\n~}" completions) "' "
"| rofi -dmenu -p "
"'" (string-right-trim ": " prompt) "'")
t)))
;; Commands ;; Commands
(defvar desktop-images-dir (defvar desktop-images-dir
(uiop:native-namestring "~/Dropbox/pictures/desktop/")) (uiop:native-namestring "~/Dropbox/pictures/desktop/"))
@ -108,10 +119,10 @@
(define-stumpwm-type :desktop-image (input prompt) (define-stumpwm-type :desktop-image (input prompt)
(or (argument-pop-rest input) (or (argument-pop-rest input)
(concatenate 'string desktop-images-dir (concatenate 'string desktop-images-dir
(completing-read (current-screen) (rofi-completing-read
prompt prompt
(mapcar 'file-namestring (mapcar 'file-namestring
(uiop:directory-files desktop-images-dir)))))) (uiop:directory-files desktop-images-dir))))))
(defun run-wal (image &optional light?) (defun run-wal (image &optional light?)
(run-shell-command (run-shell-command