Why is it so hard to implement a way to smartly determine whether to use a graphical #pinentry (like pinentry-kwallet for #KDE/#Kwallet users) when you're using a desktop graphically, or fallback to a terminal-based pinentry when it should know if you cannot respond to a graphical prompt i.e. when you're in an SSH connection.

I've been trying to achieve this for so long, in so many different ways and nothing seems to work - nothing not too
janky to maintain that is. How do you do this on #Linux (specifically #ArchLinux though it shouldn't matter)? This honestly should be the default behaviour cos I couldn't think of a situation where this behaviour I'm expecting isn't the most sensible.