From 13ad6835a22c82e8578ba194242bb071a6e4ab22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thore=20B=C3=B6decker?= Date: Tue, 21 Aug 2018 09:09:25 -0400 Subject: [PATCH] make history length configurable through env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thore Bödecker --- clipmenu | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/clipmenu b/clipmenu index 08b0774..f22990a 100755 --- a/clipmenu +++ b/clipmenu @@ -2,6 +2,7 @@ : "${CM_LAUNCHER=dmenu}" : "${CM_DIR="${XDG_RUNTIME_DIR-"${TMPDIR-/tmp}"}"}" +: "${CM_HISTLENGTH=8}" major_version=5 @@ -44,12 +45,8 @@ if [[ "$CM_LAUNCHER" == rofi-script ]]; then chosen_line="${@: -1}" fi else - # It's okay to hardcode `-l 8` here as a sensible default without checking - # whether `-l` is also in "$@", because the way that dmenu works allows a later - # argument to override an earlier one. That is, if the user passes in `-l`, our - # one will be ignored. chosen_line=$( - list_clips | "$CM_LAUNCHER" -l 8 "$@" + list_clips | "$CM_LAUNCHER" -l "${CM_HISTLENGTH}" "$@" ) fi