On Linux one might want to use the GPaste clipboard manager. Using the GOPASS_CLIPBOARD_COPY_CMD
and GOPASS_CLIPBOARD_CLEAR_CMD
environment variables one can instruct gopass to use the GPaste client directly. This hides passwords when viewed in the manager and removes them by name after the timeout.
Both environment variables expect a path to an executable or the name of an executable in the PATH
environment variable. The executables receive the name of the password as the first argument and the password (copy) or its checksum (clear) in STDIN
. To use the GPaste client one has to use helper scripts like this:
~/.local/scripts/gopass_clipboard_copy_cmd.sh
#!/bin/sh
# gpaste-client will use the password in /dev/stdin
gpaste-client add-password "$1"
~/.local/scripts/gopass_clipboard_clear_cmd.sh
#!/bin/sh
gpaste-client delete-password "$1"
Make sure both are executable: chmod +x ~/.local/scripts/gopass_clipboard_{copy,clear}_cmd.sh
You can set the environment variables in the .profile
file of your shell, for example:
~/.bash_profile
# [...]
export GOPASS_CLIPBOARD_COPY_CMD="$HOME/.local/scripts/gopass_clipboard_copy_cmd.sh"
export GOPASS_CLIPBOARD_CLEAR_CMD="$HOME/.local/scripts/gopass_clipboard_clear_cmd.sh"
# [...]
If you are using X11 you can set the above in ~/.xprofile
.
On Wayland one may use systemd user environment variables:
~/.config/environment.d/gopass.conf
GOPASS_CLIPBOARD_COPY_CMD="$HOME/.local/scripts/gopass_clipboard_copy_cmd.sh"
GOPASS_CLIPBOARD_CLEAR_CMD="$HOME/.local/scripts/gopass_clipboard_clear_cmd.sh"
A reboot might be required.