diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-03-20 01:57:46 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-03-20 02:07:54 -0600 |
commit | 2e1520beddcea65cb1857a50e9ec5c91621a96d1 (patch) | |
tree | ba35921a7882b5d452210b6904cbe08d448c6c0e | |
parent | 9ef311d868248682a11c8cb8c0177bc9949be7b9 (diff) |
Allow selection to be overriden by $SELECTION
Some users want to use a different clipboard for pass.
Suggested-by: nand <nand@nand.wakku.to>
-rw-r--r-- | man/pass.1 | 5 | ||||
-rwxr-xr-x | src/password-store.sh | 9 |
2 files changed, 10 insertions, 4 deletions
@@ -349,6 +349,11 @@ Overrides the default root of the git repository, which is helpful if \fIPASSWORD_STORE_DIR\fP is temporarily set to a sub-directory of the default password store. .TP +.I PASSWORD_STORE_SELECTION +Overrides the selection passed to \fBxclip\fP, by default \fIclipboard\fP. See +.BR xclip (1) +for more info. +.TP .I EDITOR The location of the text editor used by \fBedit\fP. diff --git a/src/password-store.sh b/src/password-store.sh index a5d3374..4f2239f 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -7,6 +7,7 @@ umask 077 GPG_OPTS="--quiet --yes --batch --compress-algo=none" PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}" +SELECTION="${PASSWORD_STORE_SELECTION:-clipboard}" export GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git" export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}" @@ -116,11 +117,11 @@ clip() { sleep_argv0="password store sleep on display $DISPLAY" kill -9 $(grep -l -r --include="cmdline" "^$sleep_argv0" /proc/ 2>/dev/null | sed -n 's:/proc/\([0-9]\+\)/.*:\1:p' | sort | uniq) 2>/dev/null && sleep 0.1 - before="$(xclip -o -selection clipboard | base64)" - echo -n "$1" | xclip -selection clipboard + before="$(xclip -o -selection "$SELECTION" | base64)" + echo -n "$1" | xclip -selection "$SELECTION" ( ( exec -a "$sleep_argv0" sleep 45 ) - now="$(xclip -o -selection clipboard | base64)" + now="$(xclip -o -selection "$SELECTION" | base64)" [[ $now != $(echo -n "$1" | base64) ]] && before="$now" # It might be nice to programatically check to see if klipper exists, @@ -132,7 +133,7 @@ clip() { # so we axe it here: qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null - echo "$before" | base64 -d | xclip -selection clipboard + echo "$before" | base64 -d | xclip -selection "$SELECTION" ) 2>/dev/null & disown echo "Copied $2 to clipboard. Will clear in 45 seconds." } |