From dd17ab947c9f32c749f45fa483bce9d1edcf6a60 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 16 Aug 2017 20:50:45 +0200 Subject: Make xclip/xsel call configurable. Request by Dominik Kaaser --- publish | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'publish') 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" -- cgit v1.2.3