summaryrefslogtreecommitdiff
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
parent912e74ffb9edeaa2830eb60587ee8d3a70bbce3b (diff)
Make xclip/xsel call configurable. Request by Dominik Kaaser
-rwxr-xr-xcreate-temp4
-rwxr-xr-xpublish17
2 files changed, 13 insertions, 8 deletions
diff --git a/create-temp b/create-temp
index 02b6064..f72b2fd 100755
--- a/create-temp
+++ b/create-temp
@@ -31,8 +31,8 @@ TARGET="$HOME/tmp"
rmdir "$BASE/"*"/downloads" 2> /dev/null || true
rmdir "$BASE/"* 2> /dev/null || true
-[ -d "$BASE/$TODAY" ] || mkdir "$BASE/$TODAY"
-[ -d "$BASE/$TODAY/downloads" ] || mkdir -m 2773 "$BASE/$TODAY/downloads"
+mkdir -p "$BASE/$TODAY"
+[ -d "$BASE/$TODAY/downloads" ] || install -d -m 2770 -g ww-download "$BASE/$TODAY/downloads"
if ! [ -L "$TARGET" ] && [ -e "$TARGET" ]; then
echo "$0: '$TARGET' already exists and is not a symlink." >&2
exit 1;
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"