Closed concatime closed 2 years ago
For now, I have in my ~/.profile
:
PINENTRY=$(command -v pinentry 2>/dev/null)
eval $(gpg-agent --daemon --enable-ssh-support --pinentry-program="${PINENTRY:-/dev/null}")
unset PINENTRY
Is it possible change the pinentry program of a running gpg-agent from a command? If yes, I can add the command to ~/.config/sway/config.d/...
. This way, when Sway starts, it would change the pinentry program to pinentry-bemenu
.
@concatime pinenetry-bemenu should behave the same as the official graphical pinentry tools, which also just assume they run in a graphical environment. I don't think any dynamic configuration is possible. Instead you could write a wrapper scripts that implements any logic you want and executes the correct pinentry program.
Oh well, if dynamic configuration isn’t possible, the static one should.
I created a file called ~/.config/sway/config.d/10-gpg_pinentry_bemenu
with:
exec sh -c 'gpgconf --kill gpg-agent && gpg-agent --daemon --enable-ssh-support --pinentry-program="$(command -v pinentry-bemenu)"'
Also, it would be nice if you add a selection screenshot in README of the end result.
You can also create ${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec
and that will be used by /usr/bin/pinentry
.
I also added a screenshot. It's a bit small because it show the whole screen, but I think it's important to see how fits into the rest of the environment.
Hi. Is it possible to provide instructions on how to use it? Sure,
pinentry-program /usr/local/bin/pinentry-bemenu
ingpg-agent.conf
should work, but it assumes that the desktop environment is ALWAYS set. What I want (if possible), is a more dynamic approach. Usepinentry-bemenu
when Sway is running, and fallback topinentry
(pinentry-curses
orpinentry-tty
) (say, ssh session). Is it possible? I don’t master gpg yet, so bear with me :)