termux-packages/packages/pass/src-password-store.sh.patch

40 lines
2.0 KiB
Diff
Raw Normal View History

2018-06-20 01:15:57 +02:00
diff -u -r ../password-store-1.7.2/src/password-store.sh ./src/password-store.sh
--- ../password-store-1.7.2/src/password-store.sh 2018-06-14 16:58:28.000000000 +0200
+++ ./src/password-store.sh 2018-06-17 00:03:16.760901453 +0200
@@ -11,7 +11,7 @@
2017-02-27 16:03:16 +01:00
export GPG_TTY="${GPG_TTY:-$(tty 2>/dev/null)}"
2016-03-22 00:11:52 +01:00
which gpg2 &>/dev/null && GPG="gpg2"
[[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" )
2017-02-27 16:03:16 +01:00
-
+TMPDIR=$PREFIX/tmp
2016-03-22 00:11:52 +01:00
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
2017-02-27 16:03:16 +01:00
EXTENSIONS="${PASSWORD_STORE_EXTENSIONS_DIR:-$PREFIX/.extensions}"
2016-03-22 00:11:52 +01:00
X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
2018-06-20 01:15:57 +02:00
@@ -156,12 +156,13 @@
2016-03-22 00:11:52 +01:00
# trailing new lines.
local sleep_argv0="password store sleep on display $DISPLAY"
2017-02-27 16:03:16 +01:00
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
2016-03-22 00:11:52 +01:00
- 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"
(
2017-02-27 16:03:16 +01:00
( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
2016-03-22 00:11:52 +01:00
- local now="$(xclip -o -selection "$X_SELECTION" | base64)"
- [[ $now != $(echo -n "$1" | base64) ]] && before="$now"
2017-02-27 16:03:16 +01:00
+ local now="$(termux-clipboard-get | base64)"
+ #removing -n here, because termux-clipboard-get always returns a newline while xclip does not
2016-03-22 00:11:52 +01:00
+ [[ $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,
2018-06-20 01:15:57 +02:00
@@ -172,7 +173,7 @@
2016-03-22 00:11:52 +01:00
# 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"
2017-02-27 16:03:16 +01:00
+ echo "$before" | base64 -d | termux-clipboard-set
2018-06-20 01:15:57 +02:00
) >/dev/null 2>&1 & disown
2016-03-22 00:11:52 +01:00
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}