clipmenu

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

commit e89f4843bbc59bfb8fec2a026f0b129fa08ce170
parent 7a9299cc186894b203a89d0417b05cf29d4fb8a6
Author: Chris Down <chris@chrisdown.name>
Date:   Wed, 11 Mar 2020 00:46:23 +0000

truncation: Avoid harmless reporting of multi-removals on a single file

Diffstat:
Mclipmenud | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/clipmenud b/clipmenud @@ -282,7 +282,19 @@ while true; do if (( num_to_remove )); then debug "Removing $num_to_remove old clips" - files=( "${to_remove[@]/#/"$cache_dir/"}" ) + # If we had the same clip content twice, we will have two + # entries in the cache file for it. This is handled on clipmenu + # side by checking for seen lines with awk, but we should try + # to avoid doing `rm` with the same file repeatedly in the list + # for this case (which is harmless, but causes confusion when + # rm errors). + declare -A tmp_files + for file in "${to_remove[@]/#/"$cache_dir/"}"; do + tmp_files["$file"]=1 + done + files=( "${!tmp_files[@]}" ) + unset tmp_files + info "Removing the following due to overflow: ${files[*]}" rm -- "${files[@]}"