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 <[email protected]>
---
 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 dbeb710..92154ef 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -139,6 +139,14 @@ clip_sleep() {
        ( exec -a "$1" sleep "$CLIP_TIME" )
 }
 
+clip_gpaste() {
+       gpaste add-password "$3" "$2"
+       (
+               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
@@ -167,7 +175,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
+       which gpaste &>/dev/null && gpaste help | grep password &>/dev/null && 
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."
 }
 tmpdir() {
-- 
2.1.0

_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to