I got tired of pinentry popping up and interrupting whatever I was doing; I didn't find a solution elsewhere, so I wrote a little bash script to address this. This is designed for (poly|i3|way|...)bar users. The blog entry (no ads, no tracking) linked has the script verbatim, plus some rambling about the why and wherefore.
It's 22 lines of does-stuff; the rest is whitespace, comments, and instructions -- including a little blob example of using it with polybar.
A known issue is that it does occasionally pop up pinentry twice in a row when unlocking. I'm not surprised, and it has happened to me only once since I've been using it -- not enough for me to need to bother trying to address it. But I wanted to call it out.
It's not rocket science, but it took a bit of time to make sure it functioned correctly (enough), and hopefully it'll help someone else.
Maybe I don’t understand the problem but the only time that pinentry pops up for me is when I am signing something. What sort of situations does it just randomly pop up or what sort of specific apps/configuration would that happen at random?
One time this happens to me is with
duplicity
. There's always some delay between starting a backup and being asked for the key. It's probably something that should be improved in duplicity itself though...I have some timed services using gopass to get credentials for, among other things, mbsync and vdirsyncer. These run on a user cron job, and they need a password to decrypt the credentials. The credentials are cached, but the cache is cleared every couple of hours, and if the screen locks.