[PATCH] Clear clipboard selection from clippy history

Oliver Ford dev.git.password-store at ojford.com
Sat May 30 22:50:00 CEST 2020


This commit adds support to the timed clipboard clearing for the
`clippy` clipboard manager, which otherwise retains the password in
history, though the previous selection is restored to first place in
history.

Though, I wonder if a better approach might be to support a
`PASSWORD_STORE_CLIP_RM_CMD` environment variable (or similar) - or
even use a `clip_rm` function that could be overridden by an extension,
allowing somebody to write, for example, the `pass-clippy` extension
rather than every user figuring out the correct command independently
(or searching for something to copy).
---
 src/password-store.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git src/password-store.sh src/password-store.sh
index 77f3eda..e87bf08 100755
--- src/password-store.sh
+++ src/password-store.sh
@@ -189,6 +189,9 @@ clip() {
 		# Clipboard managers frequently write their history out in plaintext,
 		# so we axe it here:
 		qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
+		#
+		# Clippy's `clipdel` deletes history by regex, so we escape specials first:
+		clipdel -d "$(echo -n "$1" | sed -e 's|[]/$*.^[]|\\&|g')"
 
 		echo "$before" | $BASE64 -d | "${copy_cmd[@]}"
 	) >/dev/null 2>&1 & disown
-- 
2.26.2



More information about the Password-Store mailing list