termux-packages/packages/pass/src-password-store.sh.patch
2018-08-06 01:38:35 +02:00

40 lines
2.0 KiB
Diff

diff -u -r ../password-store-1.7.3/src/password-store.sh ./src/password-store.sh
--- ../password-store-1.7.3/src/password-store.sh 2018-08-03 03:32:48.000000000 +0000
+++ ./src/password-store.sh 2018-08-05 20:53:50.490883332 +0000
@@ -11,7 +11,7 @@
export GPG_TTY="${GPG_TTY:-$(tty 2>/dev/null)}"
which gpg2 &>/dev/null && GPG="gpg2"
[[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" )
-
+TMPDIR=$PREFIX/tmp
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
EXTENSIONS="${PASSWORD_STORE_EXTENSIONS_DIR:-$PREFIX/.extensions}"
X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
@@ -156,12 +156,13 @@
# trailing new lines.
local sleep_argv0="password store sleep on display $DISPLAY"
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
- local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | $BASE64)"
- echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard"
+ local before="$(termux-clipboard-get 2>/dev/null | $BASE64)"
+ echo -n "$1" | termux-clipboard-set || die "Error: Could not copy data to the clipboard"
(
( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
- local now="$(xclip -o -selection "$X_SELECTION" | $BASE64)"
- [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
+ local now="$(termux-clipboard-get | $BASE64)"
+ #removing -n here, because termux-clipboard-get always returns a newline while xclip does not
+ [[ $now != $(echo "$1" | $BASE64) ]] && before="$now"
# It might be nice to programatically check to see if klipper exists,
# as well as checking for other common clipboard managers. But for now,
@@ -172,7 +173,7 @@
# so we axe it here:
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
- echo "$before" | $BASE64 -d | xclip -selection "$X_SELECTION"
+ echo "$before" | $BASE64 -d | termux-clipboard-set
) >/dev/null 2>&1 & disown
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}