summaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2013-01-27 18:01:24 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2013-01-27 18:01:24 +0000
commit1697ddfe8e57176319e79bed951198a8c8497d6f (patch)
treea311ab8fbf3c870a72231ad448486a121caed164 /publish
parentf31023508a768febf32ca2f4936a5d509fbee45a (diff)
publish: add xsel support
Signed-off-by: Peter Palfrader <peter@palfrader.org> git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@575 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'publish')
-rwxr-xr-xpublish13
1 files changed, 11 insertions, 2 deletions
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