Signed-off-by: Marc-Antoine Perennou <[email protected]>
---
 src/password-store.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index d535a74..06fb33f 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -127,12 +127,12 @@ check_sneaky_paths() {
 # BEGIN platform definable
 #
 
-clip() {
+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
        # trailing new lines.
-       local sleep_argv0="password store sleep on display $DISPLAY"
-       pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
+       local sleep_argv0="$1"
+       shift
        local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | 
base64)"
        echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not 
copy data to the clipboard"
        (
@@ -151,6 +151,11 @@ clip() {
 
                echo "$before" | base64 -d | xclip -selection "$X_SELECTION"
        ) 2>/dev/null & disown
+}
+clip() {
+       local sleep_argv0="password store sleep on display $DISPLAY"
+       pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
+       clip_xclip "$sleep_argv0" "$@"
        echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
 }
 tmpdir() {
-- 
2.3.3

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

Reply via email to