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 1/3] 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 From e7ec60cd9c43cf6049b1ee20b3458691f972f97e Mon Sep 17 00:00:00 2001 From: Chris Down Date: Tue, 21 Aug 2018 15:36:54 -0400 Subject: [PATCH 2/3] Add documentation for CM_HISTLENGTH --- clipmenu | 1 + 1 file changed, 1 insertion(+) diff --git a/clipmenu b/clipmenu index f22990a..126f79f 100755 --- a/clipmenu +++ b/clipmenu @@ -22,6 +22,7 @@ Environment variables: - $CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu) - $CM_DIR: specify the base directory to store the cache dir in (default: $XDG_RUNTIME_DIR, $TMPDIR, or /tmp) +- $CM_HISTLENGTH: specify the number of lines to show in dmenu/rofi (default: 8) EOF exit 0 fi From d76b716d9fd72cbb4a8e767e393ae6901fc6b1b8 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Tue, 21 Aug 2018 15:39:17 -0400 Subject: [PATCH 3/3] Sort environment variables in --help --- clipmenu | 2 +- clipmenud | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clipmenu b/clipmenu index 126f79f..62929eb 100755 --- a/clipmenu +++ b/clipmenu @@ -20,9 +20,9 @@ All arguments are passed through to dmenu itself. Environment variables: -- $CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu) - $CM_DIR: specify the base directory to store the cache dir in (default: $XDG_RUNTIME_DIR, $TMPDIR, or /tmp) - $CM_HISTLENGTH: specify the number of lines to show in dmenu/rofi (default: 8) +- $CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu) EOF exit 0 fi diff --git a/clipmenud b/clipmenud index 0366202..84c2c17 100755 --- a/clipmenud +++ b/clipmenud @@ -80,11 +80,11 @@ when you want to select a clip. Environment variables: -- $CM_ONESHOT: run once immediately, do not loop (default: 0) - $CM_DEBUG: turn on debugging output (default: 0) -- $CM_OWN_CLIPBOARD: take ownership of the clipboard (default: 1) -- $CM_MAX_CLIPS: maximum number of clips to store, 0 for inf (default: 1000) - $CM_DIR: specify the base directory to store the cache dir in (default: $XDG_RUNTIME_DIR, $TMPDIR, or /tmp) +- $CM_MAX_CLIPS: maximum number of clips to store, 0 for inf (default: 1000) +- $CM_ONESHOT: run once immediately, do not loop (default: 0) +- $CM_OWN_CLIPBOARD: take ownership of the clipboard (default: 1) - $CM_SELECTIONS: space separated list of the selections to manage (default: "clipboard primary") EOF exit 0