From 26c220f39d608df9f2f08bfc29aa4accf61e0c5a Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sun, 29 Mar 2020 23:52:54 -0400 Subject: [PATCH] Read wal input file from StumpWM using rofi --- stumpwm/.stumpwm.d/init.lisp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/stumpwm/.stumpwm.d/init.lisp b/stumpwm/.stumpwm.d/init.lisp index 8cf5a37..5830d36 100644 --- a/stumpwm/.stumpwm.d/init.lisp +++ b/stumpwm/.stumpwm.d/init.lisp @@ -101,6 +101,17 @@ (format nil "SUDO_ASKPASS=~~/bin/stumpwm-sudo.sh sudo -A ~S" ,cmd) ,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 (defvar desktop-images-dir (uiop:native-namestring "~/Dropbox/pictures/desktop/")) @@ -108,10 +119,10 @@ (define-stumpwm-type :desktop-image (input prompt) (or (argument-pop-rest input) (concatenate 'string desktop-images-dir - (completing-read (current-screen) - prompt - (mapcar 'file-namestring - (uiop:directory-files desktop-images-dir)))))) + (rofi-completing-read + prompt + (mapcar 'file-namestring + (uiop:directory-files desktop-images-dir)))))) (defun run-wal (image &optional light?) (run-shell-command