make history length configurable through env var

Signed-off-by: Thore Bödecker <me@foxxx0.de>
This commit is contained in:
Thore Bödecker 2018-08-21 09:09:25 -04:00 committed by Chris Down
parent 48dce54b75
commit 13ad6835a2

View file

@ -2,6 +2,7 @@
: "${CM_LAUNCHER=dmenu}" : "${CM_LAUNCHER=dmenu}"
: "${CM_DIR="${XDG_RUNTIME_DIR-"${TMPDIR-/tmp}"}"}" : "${CM_DIR="${XDG_RUNTIME_DIR-"${TMPDIR-/tmp}"}"}"
: "${CM_HISTLENGTH=8}"
major_version=5 major_version=5
@ -44,12 +45,8 @@ if [[ "$CM_LAUNCHER" == rofi-script ]]; then
chosen_line="${@: -1}" chosen_line="${@: -1}"
fi fi
else 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=$( chosen_line=$(
list_clips | "$CM_LAUNCHER" -l 8 "$@" list_clips | "$CM_LAUNCHER" -l "${CM_HISTLENGTH}" "$@"
) )
fi fi