From 85163378bca88d16c5629009e4ab43a621fbe57c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 15 Aug 2016 17:11:31 +1200 Subject: Allow timeout argument to dmp(1) --- bin/dmp | 5 ++++- man/man1/dmp.1 | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/dmp b/bin/dmp index b6c878f9..d25082dd 100755 --- a/bin/dmp +++ b/bin/dmp @@ -1,5 +1,8 @@ #!/bin/sh +# Sole optional argument is the password timeout (defaults to 10 seconds) +timeout_sec=${1:-10} + # Get the password store directory, bail if we can't pwsd=${PASSWORD_STORE_DIR:-$HOME/.password-store} pwsd=${pwsd%/} @@ -23,4 +26,4 @@ pw=$( [ -n "$pw" ] || exit # Pump the password into the clipboard xsel(2); allow 10 seconds -pass show "$pw" | xsel -ibt 10000 +pass show "$pw" | xsel -ibt "$((timeout_sec * 1000))" diff --git a/man/man1/dmp.1 b/man/man1/dmp.1 index 78fa8ec8..4cb354f0 100644 --- a/man/man1/dmp.1 +++ b/man/man1/dmp.1 @@ -4,11 +4,16 @@ \- pick a pass(1) password with dmenu(1) .SH SYNOPSIS .B dmp +.br +.B dmp 25 .SH DESCRIPTION .B dmp applies dmenu(1) to pick a password entry from a pass(1) store and put it into the X CLIPBOARD for up to 10 seconds. +.P +An optional timeout in seconds can be applied, after which xsel(1) will remove +the password from the clipboard. This timeout defaults to 10 seconds. .SH SEE ALSO -dmenu(1), pass(1) +dmenu(1), pass(1), xsel(1) .SH AUTHOR Tom Ryder -- cgit v1.2.3