X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/03b903de311946827e690f4db8b082c0ab32dc47..4be2bcd2e2f69ffa226d75f6e06ca2280a164cee:/bin/pinentry diff --git a/bin/pinentry b/bin/pinentry index 7b83ff5..0bd1062 100755 --- a/bin/pinentry +++ b/bin/pinentry @@ -2,15 +2,16 @@ # https://kevinlocke.name/bits/2019/07/31/prefer-terminal-for-gpg-pinentry set -Ce -graphics="gtk-2 gtk qt x11 gnome" +gfx="gnome gtk-2 gtk qt x11" tty="curses tty" case "${PINENTRY_USER_DATA-}" in - *USE_TTY=1*) list="$tty $graphics";; - *) list="$graphics $tty";; + # prefer tty unless USE_TTY is 0 + *USE_TTY=0*) list="$gfx $tty";; + *) list="$tty $gfx";; esac for x in $list; do - p=which "pinentry-$x" 2>/dev/null + p=$(command -v "pinentry-$x") 2>/dev/null if [ $? = 0 ]; then exec "$p" "$@" fi