From f748a2e5a6afbb9d8114cba4eb20dace5f3aa2ca Mon Sep 17 00:00:00 2001 From: Chris Down Date: Thu, 1 Nov 2018 00:35:38 +0000 Subject: [PATCH] Make timeout optional --- clipmenud | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clipmenud b/clipmenud index a5e3d98..a3b2f32 100755 --- a/clipmenud +++ b/clipmenud @@ -21,8 +21,15 @@ has_clipnotify=0 # shellcheck disable=SC2206 cm_selections=( $CM_SELECTIONS ) +if command -v timeout >/dev/null 2>&1; then + timeout_cmd=(timeout 1) +else + echo "WARN: No timeout binary. Continuing without any timeout on xsel." >&2 + timeout_cmd=() +fi + _xsel() { - timeout 1 xsel --logfile /dev/null "$@" + "${timeout_cmd[@]}" xsel --logfile /dev/null "$@" } get_first_line() {