aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Salomonsson <plattfot@gmail.com>2020-05-04 11:32:17 -0700
committerFredrik Salomonsson <plattfot@gmail.com>2020-05-04 12:06:27 -0700
commita3aa5255a2c4a873fc6368138c138f08ff06fbb9 (patch)
tree191f767de1666045f07dd91380b7055d998c8fd7
parent2772bc3058b792b5533ef73e89677fb8da4e3765 (diff)
downloadpinentry-rofi-a3aa5255a2c4a873fc6368138c138f08ff06fbb9.tar.gz
Added support for default-ok, default-cancel and default-prompt (#7)
They now set the `ok-button`, `cancel-button` and `prompt` on the pinentry struct. Rest of the options are still ignored.
-rwxr-xr-xpinentry-rofi.scm28
1 files changed, 26 insertions, 2 deletions
diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm
index 6580ea1..8490bb9 100755
--- a/pinentry-rofi.scm
+++ b/pinentry-rofi.scm
@@ -99,8 +99,32 @@ default-cf-visi=Do you really want to make your passphrase visible on the screen
default-tt-visi=Make passphrase visible
default-tt-hide=Hide passphrase
touch-file=/run/user/1000/gnupg/S.gpg-agent"
- (let ((option-re (make-regexp "^OPTION (.+)$")))
- (regexp-exec option-re line)))
+ (let ((regex-match #f)
+ (option-re (make-regexp "^OPTION (.+)$")))
+ (cond
+ ((set-and-return! regex-match
+ (regexp-exec
+ (make-regexp "^OPTION[[:blank:]]+default-ok=(.+)$") line))
+ (pinentry-set-button
+ set-pinentry-ok-button!
+ pinentry
+ (match:substring regex-match 1)))
+ ((set-and-return! regex-match
+ (regexp-exec
+ (make-regexp "^OPTION[[:blank:]]+default-cancel=(.+)$") line))
+ (pinentry-set-button
+ set-pinentry-cancel-button!
+ pinentry
+ (match:substring regex-match 1)))
+ ((set-and-return! regex-match
+ (regexp-exec
+ (make-regexp "^OPTION[[:blank:]]+default-prompt=(.+)$") line))
+ (pinentry-set-mesg
+ set-pinentry-prompt!
+ pinentry
+ (match:substring regex-match 1)))
+ ((set-and-return! regex-match (regexp-exec option-re line))))
+ regex-match))
(define (pinentry-getinfo pinentry line)
"Process line if it starts with GETINFO"