summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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