From 9ee9ce00bdaabfa4dee14cfce6025ca9cb7f37aa Mon Sep 17 00:00:00 2001 From: Bo Ørsted Andresen Date: Mon, 25 Aug 2008 22:13:57 +0000 Subject: Add -C, --xclippaste option to paste to clipboard selection buffer. Make -X, --xpaste explicitly paste to primary selection buffer. Use echo -n to avoid adding a trailing \n when pasting. Thanks to Jesús Guerrero for providing this patch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wgetpaste | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/wgetpaste b/wgetpaste index f39f012..c40fa72 100755 --- a/wgetpaste +++ b/wgetpaste @@ -251,7 +251,8 @@ Options: -i, --info append the output of \`$INFO_COMMAND\` -I, --info-only paste the output of \`$INFO_COMMAND\` only -x, --xcut read input from clipboard (requires x11-misc/xclip) - -X, --xpaste write resulting url to clipboard (requires x11-misc/xclip) + -X, --xpaste write resulting url to the X primary selection buffer (requires x11-misc/xclip) + -C, --xclippaste write resulting url to the X clipboard selection buffer (requires x11-misc/xclip) -r, --raw show url for the raw paste (no syntax highlighting or html) -t, --tee use tee to show what is being pasted @@ -320,16 +321,25 @@ showexpirations() { showurl() { echo "Your ${2}paste can be seen here: $1" [[ $XPASTE ]] && x_paste "$1" + [[ $XCLIPPASTE ]] && x_clip_paste "$1" } x_paste() { if [[ -x $(type -P xclip) ]]; then - xclip -loops 10 &>/dev/null <<< "$*" || die "xclip failed." + echo -n "$*" | xclip -selection primary -loops 10 &>/dev/null || die "xclip failed." else noxclip paste "write to" fi } +x_clip_paste() { + if [[ -x $(type -P xclip) ]]; then + echo -n "$*" | xclip -selection clipboard -loops 10 &>/dev/null || die "xclip failed." + else + noxclip clip_paste "write to" + fi +} + ### Posting helper functions # get the url to post to @@ -495,6 +505,9 @@ while [[ -n $1 ]]; do -X | --xpaste ) XPASTE=0 ;; + -C | --xclippaste ) + XCLIPPASTE=0 + ;; -* ) die "$0: unrecognized option \`$1'" ;; -- cgit v1.2.3