[PATCH] clip: add option for wl-copy --paste-once
grmat
grmat at sub.red
Thu Nov 21 17:17:12 CET 2019
If environment variable PASSWORD_STORE_PASTE_ONCE is set, the clipboard
is cleared immediately after pasting.
---
man/pass.1 | 4 ++++
src/password-store.sh | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/man/pass.1 b/man/pass.1
index a555dcb..9101e27 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -429,6 +429,10 @@ for more info.
Specifies the number of seconds to wait before restoring the clipboard, by default
\fI45\fP seconds.
.TP
+.I PASSWORD_STORE_PASTE_ONCE
+If this variable is set to \fItrue\fP, the clipboard is cleared immediately after the copied
+password has been pasted. This currently works only under wayland, using \fBwl-clipboard\fP.
+.TP
.I PASSWORD_STORE_UMASK
Sets the umask of all files modified by pass, by default \fI077\fP.
.TP
diff --git a/src/password-store.sh b/src/password-store.sh
index 1d119f2..ecc5154 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -16,6 +16,7 @@ PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
EXTENSIONS="${PASSWORD_STORE_EXTENSIONS_DIR:-$PREFIX/.extensions}"
X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}"
+PASTE_ONCE="${PASSWORD_STORE_PASTE_ONCE:-false}"
GENERATED_LENGTH="${PASSWORD_STORE_GENERATED_LENGTH:-25}"
CHARACTER_SET="${PASSWORD_STORE_CHARACTER_SET:-[:punct:][:alnum:]}"
CHARACTER_SET_NO_SYMBOLS="${PASSWORD_STORE_CHARACTER_SET_NO_SYMBOLS:-[:alnum:]}"
@@ -153,12 +154,16 @@ check_sneaky_paths() {
clip() {
if [[ -n $WAYLAND_DISPLAY ]]; then
+
local copy_cmd=( wl-copy )
local paste_cmd=( wl-paste -n )
if [[ $X_SELECTION == primary ]]; then
copy_cmd+=( --primary )
paste_cmd+=( --primary )
fi
+ if [[ $PASTE_ONCE == true ]]; then
+ copy_cmd+=( --paste-once )
+ fi
local display_name="$WAYLAND_DISPLAY"
elif [[ -n $DISPLAY ]]; then
local copy_cmd=( xclip -selection "$X_SELECTION" )
--
2.24.0
More information about the Password-Store
mailing list