summaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2017-08-16 20:50:45 +0200
committerPeter Palfrader <peter@palfrader.org>2017-08-16 20:50:49 +0200
commitdd17ab947c9f32c749f45fa483bce9d1edcf6a60 (patch)
tree7d83260ecf7064dcf6dc59208622283cd93b6880 /publish
parent912e74ffb9edeaa2830eb60587ee8d3a70bbce3b (diff)
Make xclip/xsel call configurable. Request by Dominik Kaaser
Diffstat (limited to 'publish')
-rwxr-xr-xpublish17
1 files changed, 11 insertions, 6 deletions
diff --git a/publish b/publish
index 028bd29..8589020 100755
--- a/publish
+++ b/publish
@@ -41,7 +41,7 @@
#
# The random location chosen is printed to stdout when the script finishes,
# and is copied to the xclipboard if the xclip(1) or xsel(1) utility is
-# installed.
+# installed (configurable via the clipper variable).
#
# base_http and base_rsync can be overriden in a ~/.publish.cfg shell snippet.
@@ -55,6 +55,14 @@ ttl=180
date_format='%Y-%m-%d-'
rsync_args="--compress --times --chmod=u=rwX,go=rX"
+if command -v xclip >/dev/null 2>&1; then
+ clipper=xclip
+elif command -v xsel >/dev/null 2>&1; then
+ clipper=xsel
+else
+ clipper=true
+fi
+
rsync_pre_invoke() { true ;}
rsync_post_invoke() { true ;}
@@ -297,13 +305,10 @@ if [ "$add_default_cs" -gt 0 ] ; then
shift
fi
-if command -v xclip >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
- echo -n "$main_uri" | xclip
-elif command -v xsel >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
- echo -n "$main_uri" | xsel
+if [ -n "${DISPLAY:-}" ]; then
+ echo -n "$main_uri" | $clipper
fi
-
if [ -n "${ttl}" ]; then
setup_tmpdir
echo "${ttl}" > "$tmpdir/.publish.ttl"