diff options
author | Fredrik Salomonsson <plattfot@gmail.com> | 2020-05-04 12:22:27 -0700 |
---|---|---|
committer | Fredrik Salomonsson <plattfot@gmail.com> | 2020-05-04 12:22:32 -0700 |
commit | ba2212e3f3e13104f26178a09504d5a84ebcb7c7 (patch) | |
tree | 7c09f5033732983c4584d0922f1d865dbdc02aaf | |
parent | 83e0ca672dc63833d3371cd347c6ae98b1911a9f (diff) | |
parent | 49a4253cf3cfb13dd5349eaa28fd8457389c43a5 (diff) | |
download | pinentry-rofi-ba2212e3f3e13104f26178a09504d5a84ebcb7c7.tar.gz |
Merge branch 'message_6' (#6)
-rwxr-xr-x | pinentry-rofi.scm | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm index 0c4a355..c025c37 100755 --- a/pinentry-rofi.scm +++ b/pinentry-rofi.scm @@ -289,9 +289,13 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" regex-match)) (define (pinentry-confirm pinentry line) - (let ((getpin-re (make-regexp "^CONFIRM$")) + (let ((confirm-re (make-regexp "^CONFIRM$")) + (confirm-one-button-re + (make-regexp "^CONFIRM[[:blank:]]+--one-button[[:blank:]]*$")) + (message-re (make-regexp "^MESSAGE$")) (regex-match #f)) - (when (set-and-return! regex-match (regexp-exec getpin-re line)) + (cond + ((set-and-return! regex-match (regexp-exec confirm-re line)) ;; Can probably do this with a pipe in both direction, but ;; manual warns about deadlocks so sticking with this for now. (let* ((pipe (open-pipe @@ -320,6 +324,23 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" (format #t "ERR 277 Operation cancelled\n") (force-output) (set-pinentry-ok! pinentry #f))))) + ((or (set-and-return! regex-match (regexp-exec confirm-one-button-re line)) + (set-and-return! regex-match (regexp-exec message-re line))) + (let ((pipe (open-pipe + (string-join + `("echo -e " + ,(format #f "'~a'" (pinentry-ok-button pinentry)) + "|" + ,(format #f "env DISPLAY=~a" (pinentry-display pinentry)) + "rofi -dmenu -disable-history -only-match -l 1 -i" + ,(format #f "-p '>'") + ,(format #f "-mesg ~s" (if (pinentry-error pinentry) + (format #f "~a\n~a" + (pinentry-error pinentry) + (pinentry-desc pinentry)) + (pinentry-desc pinentry))))) + OPEN_READ))) + (close-pipe pipe)))) regex-match)) (define (pinentry-bye pinentry line) |