From 1697ddfe8e57176319e79bed951198a8c8497d6f Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 27 Jan 2013 18:01:24 +0000 Subject: publish: add xsel support Signed-off-by: Peter Palfrader git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@575 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- publish | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'publish') diff --git a/publish b/publish index 2a37e5b..5231176 100755 --- a/publish +++ b/publish @@ -40,7 +40,8 @@ # automagically). # # The random location chosen is printed to stdout when the script finishes, -# and is copied to the xclipboard if the xclip(1) utility is installed· +# and is copied to the xclipboard if the xclip(1) or xsel(1) utility is +# installed. # # base_http and base_rsync can be overriden in a ~/.publish.cfg shell snippet. @@ -195,8 +196,14 @@ if [[ "$#" = 0 ]]; then cat "$stdin" | sed -e 's#^#| #' echo echo "EOF" + elif which xsel >/dev/null 2>&1; then + echo "Publishing x clipboard:" >&2 + xsel -o > "$stdin" + cat "$stdin" | sed -e 's#^#| #' + echo + echo "EOF" else - echo "xclip not installed?" >&2 + echo "Neither xclip nor xsel installed?" >&2 exit 1 fi fi @@ -251,6 +258,8 @@ fi if command -v xclip >/dev/null 2>&1; then echo -n "$main_uri" | xclip +elif command -v xsel >/dev/null 2>&1; then + echo -n "$main_uri" | xsel fi -- cgit v1.2.3