Avoid double writing if both selections are the same
This commit is contained in:
parent
8bb4ff3999
commit
e6c312b639
|
@ -116,12 +116,18 @@ while (( CM_ONESHOT )) || sleep "${CM_SLEEP:-0.5}"; do
|
|||
|
||||
debug "New clipboard entry on $selection selection: \"$first_line\""
|
||||
|
||||
# Without checking ${last_data[any]}, we often double write since both
|
||||
# selections get the same content
|
||||
if [[ ${last_data[any]} != "$data" ]]; then
|
||||
filename="$cache_dir/$(cksum <<< "$first_line")"
|
||||
debug "Writing $data to $filename"
|
||||
printf '%s' "$data" > "$filename"
|
||||
|
||||
debug "Writing $first_line to $cache_file"
|
||||
printf '%s\n' "$first_line" >> "$cache_file"
|
||||
fi
|
||||
|
||||
last_data[any]=$data
|
||||
|
||||
if (( CM_OWN_CLIPBOARD )) && [[ $selection != primary ]]; then
|
||||
# Take ownership of the clipboard, in case the original application
|
||||
|
|
Loading…
Reference in a new issue