Currently, the clipboard clear time is hard-coded to 45 seconds; someone might
want to make that time shorter or longer, so I added $CLEAR_TIME to do so.

Thanks,
Michael

---
 src/password-store.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 2500253..721b434 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -9,6 +9,7 @@ PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
 ID="$PREFIX/.gpg-id"
 GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
 GPG_OPTS="--quiet --yes --batch"
+CLEAR_TIME=45
 
 export GIT_DIR
 export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
@@ -37,7 +38,7 @@ Usage:
         List passwords.
     $program [show] [--clip,-c] pass-name
         Show existing password and optionally put it on the clipboard.
-        If put on the clipboard, it will be cleared in 45 seconds.
+        If put on the clipboard, it will be cleared in $CLEAR_TIME seconds.
     $program insert [--echo,-e | --multiline,-m] [--force,-f] pass-name
         Insert new password. Optionally, echo the password back to the console
         during entry. Or, optionally, the entry may be multiline. Prompt before
@@ -46,7 +47,7 @@ Usage:
         Insert a new password or edit an existing password using ${EDITOR:-vi}.
     $program generate [--no-symbols,-n] [--clip,-c] [--force,-f] pass-name 
pass-length
         Generate a new password of pass-length with optionally no symbols.
-        Optionally put it on the clipboard and clear board after 45 seconds.
+        Optionally put it on the clipboard and clear board after $CLEAR_TIME 
seconds.
         Prompt before overwriting existing password unless forced.
     $program rm [--recursive,-r] [--force,-f] pass-name
         Remove existing password or directory, optionally forcefully.
@@ -88,7 +89,7 @@ clip() {
        before="$(xclip -o -selection clipboard | base64)"
        echo -n "$1" | xclip -selection clipboard
        (
-               sleep 45
+               sleep "$CLEAR_TIME"
                now="$(xclip -o -selection clipboard | base64)"
                if [[ $now != $(echo -n "$1" | base64) ]]; then
                        before="$now"
@@ -105,7 +106,7 @@ clip() {
 
                echo "$before" | base64 -d | xclip -selection clipboard
        ) & disown
-       echo "Copied $2 to clipboard. Will clear in 45 seconds."
+       echo "Copied $2 to clipboard. Will clear in $CLEAR_TIME seconds."
 }
 tmpdir() {
        if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
-- 
1.8.3.1

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

Reply via email to