aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-03-20 02:12:50 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2014-03-20 02:24:17 -0600
commit072bbc617bdcbaa0cc643a67676916ac99116172 (patch)
tree4b2bfb9f03ae392107d94b6f7ac63c2d287ed147
parentMakefile: appropriate mkdir -p for completion (diff)
downloadpassword-store-072bbc617bdcbaa0cc643a67676916ac99116172.tar.xz
password-store-072bbc617bdcbaa0cc643a67676916ac99116172.zip
Configurable clipboard time.
-rw-r--r--man/pass.110
-rwxr-xr-xsrc/password-store.sh9
2 files changed, 12 insertions, 7 deletions
diff --git a/man/pass.1 b/man/pass.1
index 896ec4f..75e14a6 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -77,7 +77,7 @@ Decrypt and print a password named \fIpass-name\fP. If \fI--clip\fP or \fI-c\fP
is specified, do not print the password but instead copy the first line to the
clipboard using
.BR xclip (1)
-and then restore the clipboard after 45 seconds.
+and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds.
.TP
\fBinsert\fP [ \fI--echo\fP, \fI-e\fP | \fI--multiline\fP, \fI-m\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name\fP
Insert a new password into the password store called \fIpass-name\fP. This will
@@ -104,7 +104,8 @@ is specified, do not use any non-alphanumeric characters in the generated passwo
If \fI--clip\fP or \fI-c\fP is specified, do not print the password but instead copy
it to the clipboard using
.BR xclip (1)
-and then restore the clipboard after 45 seconds. Prompt before overwriting an existing password,
+and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds.
+Prompt before overwriting an existing password,
unless \fI--force\fP or \fI-f\fP is specified.
.TP
\fBrm\fP [ \fI--recursive\fP, \fI-r\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name\fP
@@ -354,9 +355,12 @@ Overrides the selection passed to \fBxclip\fP, by default \fIclipboard\fP. See
.BR xclip (1)
for more info.
.TP
+.I PASSWORD_STORE_CLIP_TIME
+Specifies the number of seconds to wait before restoring the clipboard, by default
+\fI45\fP seconds.
+.TP
.I EDITOR
The location of the text editor used by \fBedit\fP.
-
.SH SEE ALSO
.BR gpg2 (1),
.BR pwgen (1),
diff --git a/src/password-store.sh b/src/password-store.sh
index 4f2239f..3040a17 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -8,6 +8,7 @@ umask 077
GPG_OPTS="--quiet --yes --batch --compress-algo=none"
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
SELECTION="${PASSWORD_STORE_SELECTION:-clipboard}"
+CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}"
export GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
@@ -29,14 +30,14 @@ usage() {
cat <<_EOF
Usage:
- $program init [--reencrypt,-e] gpg-id
+ $program init [--reencrypt,-e] [--path=subfolder,-p subfolder] gpg-id...
Initialize new password storage and use gpg-id for encryption.
Optionally reencrypt existing passwords using new gpg-id.
$program [ls] [subfolder]
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 $CLIP_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
@@ -120,7 +121,7 @@ clip() {
before="$(xclip -o -selection "$SELECTION" | base64)"
echo -n "$1" | xclip -selection "$SELECTION"
(
- ( exec -a "$sleep_argv0" sleep 45 )
+ ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
now="$(xclip -o -selection "$SELECTION" | base64)"
[[ $now != $(echo -n "$1" | base64) ]] && before="$now"
@@ -135,7 +136,7 @@ clip() {
echo "$before" | base64 -d | xclip -selection "$SELECTION"
) 2>/dev/null & disown
- echo "Copied $2 to clipboard. Will clear in 45 seconds."
+ echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}
tmpdir() {
if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then