diff options
author | Fredrik Salomonsson <plattfot@gmail.com> | 2020-05-01 16:02:27 -0700 |
---|---|---|
committer | Fredrik Salomonsson <plattfot@gmail.com> | 2020-05-01 16:02:27 -0700 |
commit | ed4cc12f342f82171f4e4b86ff0bf1ec412a7b0a (patch) | |
tree | 511b7f87503b245871b8b6f9c17400e32402e4b5 /pinentry-rofi.scm | |
parent | 2492961ddbb61fee7abefba4943ed19d3e5d18e5 (diff) | |
download | pinentry-rofi-ed4cc12f342f82171f4e4b86ff0bf1ec412a7b0a.tar.gz |
Resetting pinentry-ok when a command succeeds
Diffstat (limited to 'pinentry-rofi.scm')
-rwxr-xr-x | pinentry-rofi.scm | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm index 46ba157..b2d194b 100755 --- a/pinentry-rofi.scm +++ b/pinentry-rofi.scm @@ -87,13 +87,17 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" (cond ((string=? info "pid") (format #t "D ~a\n" (getpid)) - (force-output))))) + (force-output)))) + (set-pinentry-ok! pinentry #t)) regex-match)) (define (pinentry-setkeyinfo pinentry line) "SETKEYINFO s/FINGERPRINT" - (let ((setkeyinfo-re (make-regexp "^SETKEYINFO (.+)$"))) - (regexp-exec setkeyinfo-re line))) + (let ((setkeyinfo-re (make-regexp "^SETKEYINFO (.+)$")) + (regex-match #f)) + (when (set-and-return! regex-match (regexp-exec setkeyinfo-re line)) + (set-pinentry-ok! pinentry #t)) + regex-match)) (define (html-< str) "Replace < with <" @@ -113,7 +117,8 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" (regex-match #f)) (when (set-and-return! regex-match (regexp-exec setdesc-re line)) (let ((mesg (hex->char (html-< (match:substring regex-match 1))))) - (set-pinentry-desc! pinentry mesg))) + (set-pinentry-desc! pinentry mesg)) + (set-pinentry-ok! pinentry #t)) regex-match)) (define (pinentry-seterror pinentry line) @@ -122,7 +127,8 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" (regex-match #f)) (when (set-and-return! regex-match (regexp-exec seterror-re line)) (let ((mesg (hex->char (html-< (match:substring regex-match 1))))) - (set-pinentry-error! pinentry mesg))) + (set-pinentry-error! pinentry mesg) + (set-pinentry-ok! pinentry #t))) regex-match)) (define (pinentry-setprompt pinentry line) @@ -130,7 +136,8 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" (let ((setprompt-re (make-regexp "^SETPROMPT (.+)$")) (regex-match #f)) (when (set-and-return! regex-match (regexp-exec setprompt-re line)) - (set-pinentry-prompt! pinentry (match:substring regex-match 1))) + (set-pinentry-prompt! pinentry (match:substring regex-match 1)) + (set-pinentry-ok! pinentry #t)) regex-match)) (define (pinentry-getpin pinentry line) @@ -156,9 +163,11 @@ touch-file=/run/user/1000/gnupg/S.gpg-agent" (pass (get-string-all pipe)) (status (close-pipe pipe))) (if (equal? (status:exit-val status) 0) - (unless (string-empty? pass) - (format #t "D ~a" pass) - (force-output)) + (begin + (unless (string-empty? pass) + (format #t "D ~a" pass) + (force-output)) + (set-pinentry-ok! pinentry #t)) (begin (format #t "ERR 83886179 Operation cancelled <rofi>\n") (force-output) |