You can use the PINENTRY_USER_DATA
environment variable to give gpg
information to pass to the pinentry command. You then need to set pinentry-program
to a custom wrapper such as this that will run the curses or the GTK pinentry depending on that variable.
Note that this only seems to work with GPG 2.x, contrary to what the documentation of GPG 1.x says.
So with that script, you use gpg2
to use pinentry-curses
and PINENTRY_USER_DATA="gtk" gpg2
to use pinentry-gtk-2
.