Note: Edited for clarification
pfr And would this go in ~/.profile rather than my ~/.shrc
The other way around. ~/.profile
is only executed if the shell is a login shell; the other one is executed by any interactive shell. So, you want the latter (whose name depends on the shell--see specific man pages) to set GPG_TTY
.
pfr EDIT: It works without doing this
Yes, it would. Since the pass
command is running inside xterm, it (or whatever gpg program it calls) can get the pseudo-tty name it is running in by just running tty(1)
if GPG_TTY is unset.
pfr however is there any other reason I should do this?
It's a default backup, but, you could use it--with major caveats--to run pass
the way you were trying to originally ie. without an xterm
. This failed because no xterm means no tty to do I/O to. But, you can, say, do I/O to some other terminal instead. Try it out yourself. Open multiple xterms; run tty
in each window; then, in a separate window type:
GPG_TTY=/dev/pts/N gpg-connect-agent "GET_PASSPHRASE X X X Password+please" /bye
Replace N with tty-number of the pseudo-ttys you noted earlier.
pfr Is it possible to launch an xterm and actually specify a custom WM_CLASS(STRING) ?
If you're talking about the X property WM_CLASS, then yes. Use xprop
to set properties.
pin Yes, but it will affect all launched instances.
xterm
has a -name
option to set a custom name. I don't know what it is that you guys are trying to do with X properties, but, you can use that as a basis to identify specific xterm windows.