Last active
May 26, 2017 04:58
-
-
Save AeliusSaionji/f3455191b378ed010283e4871a374bf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/pass 2017-03-27 00:32:12.000000000 -0400 | |
+++ b/pass 2017-03-28 08:55:28.249545500 -0400 | |
@@ -154,13 +154,13 @@ | |
# This base64 business is because bash cannot store binary data in a shell | |
# variable. Specifically, it cannot store nulls nor (non-trivally) store | |
# trailing new lines. | |
- local sleep_argv0="password store sleep on display $DISPLAY" | |
+ local sleep_argv0="password store sleep" | |
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="$(cat /dev/clipboard 2>/dev/null | base64)" | |
+ echo -n "$1" > /dev/clipboard || 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)" | |
+ local now="$(cat /dev/clipboard | base64)" | |
[[ $now != $(echo -n "$1" | base64) ]] && before="$now" | |
# It might be nice to programatically check to see if klipper exists, | |
@@ -172,7 +172,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 > /dev/clipboard | |
) 2>/dev/null & disown | |
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment