I use xterm as my terminal emulator and pass as my main password store. Usually xterm pastes from the primary selection (middle click or C-Insert). Read this thread for further information. I like xterms standard behavior as well and I am not willing to change it just to make it work with pass. To paste my passwords in xterm I use following workaround:
pass foobar/baz/bar | xclip
Above example pipes the output of pass (password for foobar/baz/bar in cleartext) to xclip, which writes it to the primary selection as default (man xclip
). Middle click and C-Insert paste the password as expected.
Another solution is described in the ArchWiki:
export PASSWORD_STORE_X_SELECTION=primary
If you use this approach, pass -c
will now copy to the primary selection but still outputs "Copied foobar/baz/bar to clipboard. Will clear in 45 seconds."
.
Maybe I am going to work on a patch. An new option --primary
would indeed be my favorite solution…
If you have any questions, suggestions, thoughts and comments please feel free to email me.
License of this blog post:
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.