2018-08-09 09:12:07 +01:00
|
|
|
From d11261c2ad184daf6e9edd777bc8a3372c277b4b Mon Sep 17 00:00:00 2001
|
|
|
|
From: Johannes Frankenau <johannes@frankenau.net>
|
|
|
|
Date: Fri, 10 Aug 2018 09:49:57 +0200
|
2017-04-10 15:31:00 +01:00
|
|
|
Subject: [PATCH] Patch the clip() function to work even when using
|
|
|
|
single-binary coreutils
|
|
|
|
|
|
|
|
---
|
|
|
|
src/password-store.sh | 4 ++--
|
|
|
|
src/platform/cygwin.sh | 4 ++--
|
|
|
|
src/platform/darwin.sh | 4 ++--
|
|
|
|
3 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/src/password-store.sh b/src/password-store.sh
|
2018-08-09 09:12:07 +01:00
|
|
|
index 7264ffc..68551a4 100755
|
2017-04-10 15:31:00 +01:00
|
|
|
--- a/src/password-store.sh
|
|
|
|
+++ b/src/password-store.sh
|
|
|
|
@@ -155,11 +155,11 @@ clip() {
|
|
|
|
# variable. Specifically, it cannot store nulls nor (non-trivally) store
|
|
|
|
# trailing new lines.
|
|
|
|
local sleep_argv0="password store sleep on display $DISPLAY"
|
|
|
|
- pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
|
|
|
|
+ pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5
|
2018-08-09 09:12:07 +01:00
|
|
|
local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | $BASE64)"
|
2017-04-10 15:31:00 +01:00
|
|
|
echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard"
|
|
|
|
(
|
|
|
|
- ( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
|
|
|
|
+ ( exec -a "$sleep_argv0" bash <(echo trap 'kill %1' TERM\; sleep "$CLIP_TIME & wait") )
|
2018-08-09 09:12:07 +01:00
|
|
|
local now="$(xclip -o -selection "$X_SELECTION" | $BASE64)"
|
|
|
|
[[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
|
2017-04-10 15:31:00 +01:00
|
|
|
|
|
|
|
diff --git a/src/platform/cygwin.sh b/src/platform/cygwin.sh
|
2018-08-09 09:12:07 +01:00
|
|
|
index 5a8d5ea..423e0ce 100644
|
2017-04-10 15:31:00 +01:00
|
|
|
--- a/src/platform/cygwin.sh
|
|
|
|
+++ b/src/platform/cygwin.sh
|
|
|
|
@@ -3,11 +3,11 @@
|
|
|
|
|
|
|
|
clip() {
|
|
|
|
local sleep_argv0="password store sleep on display $DISPLAY"
|
|
|
|
- pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
|
|
|
|
+ pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5
|
2018-08-09 09:12:07 +01:00
|
|
|
local before="$($BASE64 < /dev/clipboard)"
|
2017-04-10 15:31:00 +01:00
|
|
|
echo -n "$1" > /dev/clipboard
|
|
|
|
(
|
|
|
|
- ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
|
|
|
|
+ ( exec -a "$sleep_argv0" bash <(echo sleep "$CLIP_TIME") )
|
2018-08-09 09:12:07 +01:00
|
|
|
local now="$($BASE64 < /dev/clipboard)"
|
|
|
|
[[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
|
|
|
|
echo "$before" | $BASE64 -d > /dev/clipboard
|
2017-04-10 15:31:00 +01:00
|
|
|
diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
|
2018-08-09 09:12:07 +01:00
|
|
|
index 342ecce..9e12837 100644
|
2017-04-10 15:31:00 +01:00
|
|
|
--- a/src/platform/darwin.sh
|
|
|
|
+++ b/src/platform/darwin.sh
|
|
|
|
@@ -3,11 +3,11 @@
|
|
|
|
|
|
|
|
clip() {
|
|
|
|
local sleep_argv0="password store sleep for user $(id -u)"
|
|
|
|
- pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
|
|
|
|
+ pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5
|
2018-08-09 09:12:07 +01:00
|
|
|
local before="$(pbpaste | $BASE64)"
|
2017-04-10 15:31:00 +01:00
|
|
|
echo -n "$1" | pbcopy
|
|
|
|
(
|
|
|
|
- ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
|
|
|
|
+ ( exec -a "$sleep_argv0" bash <(echo sleep "$CLIP_TIME") )
|
2018-08-09 09:12:07 +01:00
|
|
|
local now="$(pbpaste | $BASE64)"
|
|
|
|
[[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
|
|
|
|
echo "$before" | $BASE64 -d | pbcopy
|
2017-04-10 15:31:00 +01:00
|
|
|
--
|
2018-08-09 09:12:07 +01:00
|
|
|
2.16.4
|
2017-04-10 15:31:00 +01:00
|
|
|
|