m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-03-20 01:57:46 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2014-03-20 02:07:54 -0600
commit2e1520beddcea65cb1857a50e9ec5c91621a96d1 (patch)
treeba35921a7882b5d452210b6904cbe08d448c6c0e /src
parent9ef311d868248682a11c8cb8c0177bc9949be7b9 (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>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/password-store.sh9
1 files changed, 5 insertions, 4 deletions
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."
}