password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit 2e1520beddcea65cb1857a50e9ec5c91621a96d1
parent 9ef311d868248682a11c8cb8c0177bc9949be7b9
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Thu, 20 Mar 2014 01:57:46 -0600

Allow selection to be overriden by $SELECTION

Some users want to use a different clipboard for pass.

Suggested-by: nand <nand@nand.wakku.to>

Diffstat:
Mman/pass.1 | 5+++++
Msrc/password-store.sh | 9+++++----
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/man/pass.1 b/man/pass.1 @@ -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 @@ -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." }