clipmenu

Simple clipboard management using dmenu
git clone https://git.sinitax.com/cdown/clipmenu
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 2cd2287612a541260e4a6973045479b354a4febf
parent 60611584ecb72b0e05f773b9823e60153f30b21e
Author: Chris Down <chris@chrisdown.name>
Date:   Wed, 31 May 2017 20:01:56 +0100

Add more documentation on -h/--help for clipmenu{,d}

Diffstat:
Mclipmenu | 18+++++++++---------
Mclipmenud | 16++++++++++++++++
2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/clipmenu b/clipmenu @@ -10,14 +10,8 @@ shopt -s nullglob cache_dir=$TMPDIR/clipmenu.$major_version.$USER cache_file=$cache_dir/line_cache - -if [[ "$CM_LAUNCHER" == rofi ]]; then - # rofi supports dmenu-like arguments through the -dmenu flag - set -- -dmenu "$@" -fi - -if [[ $1 == --help ]]; then - cat << EOF +if [[ $1 == --help ]] || [[ $1 == -h ]]; then + cat << 'EOF' clipmenu is a simple clipboard manager using dmenu and xsel. Launch this when you want to select a clip. @@ -25,11 +19,17 @@ All arguments are passed through to dmenu itself. Environment variables: -- \$CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu) +- $CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu) +- $TMPDIR: specify the base directory to store the cache dir in (default: /tmp) EOF exit 0 fi +if [[ "$CM_LAUNCHER" == rofi ]]; then + # rofi supports dmenu-like arguments through the -dmenu flag + set -- -dmenu "$@" +fi + # 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 diff --git a/clipmenud b/clipmenud @@ -52,6 +52,22 @@ debug() { fi } +if [[ $1 == --help ]] || [[ $1 == -h ]]; then + cat << 'EOF' +clipmenud is the daemon that collects and caches what's on the clipboard. +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) +- $TMPDIR: specify the base directory to store the cache dir in (default: /tmp) +EOF + exit 0 +fi + + # It's ok that this only applies to the final directory. # shellcheck disable=SC2174 mkdir -p -m0700 "$cache_dir"