OpenPGP: gpgsm hangs, system gpg-agent likes to grab the socket

Hi.

I’m using the OnlyKey a lot for SSH/PGP on Linux, but there are two main problems.

I’m using KDE, so I have set up both .config/plasma-workspace/env/onlykey.sh and user-level systemd units for the standard gpg socket and onlykey-agent.

SSH works nicely, but with PGP there are two problems:

  1. gpg always launches gpgsm the second Kleopatra or Kmail try to do anything, this ends up with gpgsm hogging the lockfile indefinitely. Once I killall gpgsm, everything proceeds as normal.
  2. System-wide gpg-agent really likes to hog the standard socket. I always end up with my non-Onlykey keyring instead, precisely at the times I don’t need it. How can I stop this from happening?