[pass] [PATCH 2/2] clip: add GPaste support

Marc-Antoine Perennou Marc-Antoine at Perennou.com
Fri Mar 13 13:14:25 CET 2015


Still no review on this…What is the correct way of getting at least a yes/no if this list isn't?  Regards, Marc-Antoine   



GPaste is a clipboard which now supports password natively without writing

them to its history file and displaying a given name to identify them.



Signed-off-by: Marc-Antoine Perennou <Marc-Antoine at Perennou.com>

---

 src/password-store.sh | 16 +++++++++++++++-

 1 file changed, 15 insertions(+), 1 deletion(-)



diff --git a/src/password-store.sh b/src/password-store.sh

index d10b7c2..4d6a51a 100755

--- a/src/password-store.sh

+++ b/src/password-store.sh

@@ -131,6 +131,14 @@ clip_sleep() {

 	( exec -a "$1" sleep "$CLIP_TIME" )

 }

  
+clip_gpaste() {

+	gpaste add-password "$3" "$2" || die "Error: Could not copy data to the clipboard"

+	(

+		clip_sleep "$1"

+		gpaste delete-password "$3"

+	) 2>/dev/null & disown

+}

+

 clip_xclip() {

 	# This base64 business is because bash cannot store binary data in a shell

 	# variable. Specifically, it cannot store nulls nor (non-trivally) store

@@ -158,7 +166,13 @@ clip_xclip() {

 clip() {

 	local sleep_argv0="password store sleep on display $DISPLAY"

 	pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5

-	clip_xclip "$sleep_argv0" "$@"

+	local gpaste=0

+	gpaste help | grep -q password && gpaste=1

+	if [[ $gpaste -eq 1 ]]; then

+		clip_gpaste "$sleep_argv0" "$@"

+	else

+		clip_xclip "$sleep_argv0" "$@"

+	fi

 	echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."

 }

  
--  
2.2.2



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20150313/27d6d0fb/attachment.html>


More information about the Password-Store mailing list