aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-22 15:51:43 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-02-22 15:51:43 -0300
commit23fc1ebe8d32940730007026a76e1819fdc0bb1a (patch)
treecf3e4546590b8df89c097826378e008d3fa6e483
parent73eda56a8a1c0d2e262bfad5dee96deb7d4bcb62 (diff)
downloadkeyringer-23fc1ebe8d32940730007026a76e1819fdc0bb1a.tar.gz
keyringer-23fc1ebe8d32940730007026a76e1819fdc0bb1a.tar.bz2
Formatting xclip function
-rwxr-xr-xlib/keyringer/actions/xclip48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/keyringer/actions/xclip b/lib/keyringer/actions/xclip
index e33c261..7afdf05 100755
--- a/lib/keyringer/actions/xclip
+++ b/lib/keyringer/actions/xclip
@@ -7,33 +7,33 @@
# Function thanks to Password Store by Jason A. Donenfeld <Jason@zx2c4.com>
# distributed under GPLv2+: http://www.zx2c4.com/projects/password-store/
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,
- # we're going with this for now.
+ # 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,
+ # we're going with this for now.
#local xclip="xclip -selection clipboard"
local xclip="xclip"
- before="$($xclip -o | base64)"
- echo -n "$1" | $xclip
- (
- sleep 45
- now="$($xclip -o | base64)"
- if [[ $now != $(echo -n "$1" | base64) ]]; then
- before="$now"
- fi
-
- # It might be nice to programatically check to see if klipper exists,
- # as well as checking for other common clipboard managers. But for now,
- # this works fine -- if qdbus isn't there or if klipper isn't running,
- # this essentially becomes a no-op.
- #
- # Clipboard managers frequently write their history out in plaintext,
- # so we axe it here:
- qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
-
- echo "$before" | base64 -d | $xclip
- ) & disown
- echo "Copied $2 to clipboard. Will clear in 45 seconds."
+ before="$($xclip -o | base64)"
+ echo -n "$1" | $xclip
+ (
+ sleep 45
+ now="$($xclip -o | base64)"
+ if [[ $now != $(echo -n "$1" | base64) ]]; then
+ before="$now"
+ fi
+
+ # It might be nice to programatically check to see if klipper exists,
+ # as well as checking for other common clipboard managers. But for now,
+ # this works fine -- if qdbus isn't there or if klipper isn't running,
+ # this essentially becomes a no-op.
+ #
+ # Clipboard managers frequently write their history out in plaintext,
+ # so we axe it here:
+ qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
+
+ echo "$before" | base64 -d | $xclip
+ ) & disown
+ echo "Copied $2 to clipboard. Will clear in 45 seconds."
}
# Load functions