clipmenu

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

commit 8de3d7a9c5b8d718dab2ffdea9c2cdcd06c0ac09
parent 099aeb3e22a672cd312f8b1418993daa83482b15
Author: Chris Down <chris@chrisdown.name>
Date:   Mon, 23 Mar 2020 17:02:59 +0000

Check clipboard selection for ownership explicitly

We no longer need to do the element_in checks, just do it for this
selection when it runs.

Diffstat:
Mclipmenud | 15+--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/clipmenud b/clipmenud @@ -10,7 +10,6 @@ # > 0. CM_MAX_CLIPS_THRESH=$(( CM_MAX_CLIPS + 100 )) - # Shellcheck is mistaken here, this is used later as lowercase. # shellcheck disable=SC2153 : "${CM_SELECTIONS=clipboard primary}" @@ -97,17 +96,6 @@ debug() { fi } -element_in() { - local item element - item="$1" - for element in "${@:2}"; do - if [[ "$item" == "$element" ]]; then - return 0 - fi - done - return 1 -} - if [[ $1 == --help ]] || [[ $1 == -h ]]; then cat << 'EOF' clipmenud is the daemon that collects and caches what's on the clipboard. @@ -248,8 +236,7 @@ while true; do last_cache_file_output[$selection]=$cache_file_output - if (( CM_OWN_CLIPBOARD )) && [[ $selection != primary ]] && - element_in clipboard "${cm_selections[@]}"; then + if (( CM_OWN_CLIPBOARD )) && [[ $selection == clipboard ]]; then # Take ownership of the clipboard, in case the original application # is unable to serve the clipboard request (due to being suspended, # etc).