[PATCH] Add ENV variable to force qrcode rendering in terminal
Marcus Hildum
marcus.hildum at gmail.com
Tue Nov 2 22:15:34 UTC 2021
I prefer to have my qrcodes rendered in the terminal and currently
pass defaults to using feh, graphicsmagick, or imagemagick (in that order)
to render qrcodes if they're installed. Given that many other parts of pass
are customized with environment variables I figured that was a good way to
force terminal rendering if the user so chose.
---
man/pass.1 | 3 +++
src/password-store.sh | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/man/pass.1 b/man/pass.1
index a555dcb..8507997 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -463,6 +463,9 @@ upper-case fingerprint in this variable. If multiple fingerprints are specified,
separated by a whitespace character, then signatures must match at least one.
The \fBinit\fP command will keep signatures of \fB.gpg-id\fP files up to date.
.TP
+.I PASSWORD_FORCE_TERMINAL_QRCODE
+If this environment variable is set, then qrencode will render to the terminal using utf8
+.TP
.I EDITOR
The location of the text editor used by \fBedit\fP.
.SH SEE ALSO
diff --git a/src/password-store.sh b/src/password-store.sh
index aef8d72..1d54fb1 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -19,6 +19,7 @@ CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}"
GENERATED_LENGTH="${PASSWORD_STORE_GENERATED_LENGTH:-25}"
CHARACTER_SET="${PASSWORD_STORE_CHARACTER_SET:-[:punct:][:alnum:]}"
CHARACTER_SET_NO_SYMBOLS="${PASSWORD_STORE_CHARACTER_SET_NO_SYMBOLS:-[:alnum:]}"
+FORCE_TERMINAL_QRCODE="${PASSWORD_FORCE_TERMINAL_QRCODE}"
unset GIT_DIR GIT_WORK_TREE GIT_NAMESPACE GIT_INDEX_FILE GIT_INDEX_VERSION GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
export GIT_CEILING_DIRECTORIES="$PREFIX/.."
@@ -198,7 +199,7 @@ clip() {
}
qrcode() {
- if [[ -n $DISPLAY || -n $WAYLAND_DISPLAY ]]; then
+ if [[ ( -n $DISPLAY || -n $WAYLAND_DISPLAY ) && -z $FORCE_TERMINAL_QRCODE ]]; then
if type feh >/dev/null 2>&1; then
echo -n "$1" | qrencode --size 10 -o - | feh -x --title "pass: $2" -g +200+200 -
return
--
2.32.0
More information about the Password-Store
mailing list