Make passmenu Show GUI Pinentry When Using Pinentry Curses by Default
Let’s take a look at how to use a GUI
pinentry for one program, and
for everything else.
I’m on Arch Linux using
i3wm as a window manager and
pass as my password
pass comes with a handy script,
passmenu, that allows you to find
your password from within the status bar,
dmenu. This way you won’t have to
open a terminal every time you want to copy a password.
However, I had instructed
gpg-agent to use
meant that every time I invoked
passmenu and my PGP password was not already
cached, nothing appeared to happen. (In fact, it would open the
pinentry-curses in a terminal not accessible to me and time out.)
So here is how to use a different
First, create a wrapper script for
#!/usr/bin/env bash # # Defaults to Qt, with a choice of curses for selected programs # PINENTRY_USER_DATA is a GnuPG defined variable (see man gpg) case "$PINENTRY_USER_DATA" in gtk) exec /usr/bin/pinentry "$@" ;; *) exec /usr/bin/pinentry-curses "$@" ; esac
Make this script executable:
$ chmod u+x ~/bin/pinentry-wrapper
Instruct GnuGP to use your version of
$ pkill -HUP gpg-agent
Create a wrapper script for
#!/usr/bin/env bash PINENTRY_USER_DATA=gtk /usr/bin/passmenu "$@"
Make it executable:
$ chmod u+x ~/bin/passmenu
~/binis searched first in your
PATH(put this in your
$ export PATH="~/bin:$PATH"
Check your work:
$ command -v passmenu /home/neftas/bin/passmenu
PINENTRY_USER_DATA and not
man pgp tells us that:
PINENTRY_USER_DATA This value is passed via gpg-agent to pinentry. It is useful to convey extra information to a custom pinentry.