aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/xclip
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-06-27 09:06:39 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-06-27 09:06:39 -0300
commitfd78b1ee84d46724730c00c0c4f6eefa77017173 (patch)
tree491a338e418f1ca28aaeb2b21898e8e7f462f3b9 /lib/keyringer/actions/xclip
parent14e9486dfc5e1f522223b37697e4cb9bc14d88fa (diff)
parent605e747eee231ebb364aa84a3a54cb3e362e5efa (diff)
downloadkeyringer-fd78b1ee84d46724730c00c0c4f6eefa77017173.tar.gz
keyringer-fd78b1ee84d46724730c00c0c4f6eefa77017173.tar.bz2
Update upstream source from tag 'upstream_keyringer_0.5.7'
Update to upstream version '0.5.7' with Debian dir a5c6add4ce0fd017876ca3784917bbbc739a9a6d
Diffstat (limited to 'lib/keyringer/actions/xclip')
-rwxr-xr-xlib/keyringer/actions/xclip11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/keyringer/actions/xclip b/lib/keyringer/actions/xclip
index da86315..f63fdb5 100755
--- a/lib/keyringer/actions/xclip
+++ b/lib/keyringer/actions/xclip
@@ -4,8 +4,11 @@
#
# Copy contents to clipboard.
+#
# Function thanks to Password Store by Jason A. Donenfeld <Jason@zx2c4.com>
# distributed under GPLv2+: http://www.zx2c4.com/projects/password-store/
+#
+# Adapted by rhatto
clip() {
# This base64 business is a disgusting hack to deal with newline inconsistancies
# in shell. There must be a better way to deal with this, but because I'm a dolt,
@@ -14,7 +17,15 @@ clip() {
#local xclip="xclip -selection clipboard"
local xclip="xclip"
before="$($xclip -o | base64)"
+
+ # Avoid "Error: target STRING not available"
+ # https://github.com/astrand/xclip/issues/38
+ echo "$RANDOM" | $xclip
+
+ # Copy text into clipboard
echo -n "$1" | $xclip
+
+ # Cleanup procedure
(
sleep 45
now="$($xclip -o | base64)"