commit f748a2e5a6afbb9d8114cba4eb20dace5f3aa2ca parent a80efc202e08830095ec0a347c881c3f3c06ad1f Author: Chris Down <chris@chrisdown.name> Date: Thu, 1 Nov 2018 00:35:38 +0000 Make timeout optional Diffstat:
M | clipmenud | | | 9 | ++++++++- |
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git 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() {