commit 55407ba3f622c99b1efafbe6b6371680f6abd8f6
parent b5e8543b3ee254b179ebd4dd4b7f31858c8f0e03
Author: Chris Down <chris@chrisdown.name>
Date: Mon, 19 Feb 2018 14:51:00 +0000
Remove last_data checks
Nowadays everything should be using clipnotify, which avoids constantly
copying the same data.
Diffstat:
1 file changed, 5 insertions(+), 20 deletions(-)
diff --git a/clipmenud b/clipmenud
@@ -85,8 +85,6 @@ fi
# shellcheck disable=SC2174
mkdir -p -m0700 "$cache_dir"
-declare -A last_data
-
command -v clipnotify >/dev/null 2>&1 && has_clipnotify=1
if ! (( has_clipnotify )); then
@@ -137,29 +135,16 @@ while true; do
continue
fi
- if [[ ${last_data[$selection]} == "$data" ]]; then
- debug 'Skipping as last selection is the same as this one'
- continue
- fi
-
- last_data[$selection]=$data
-
first_line=$(get_first_line "$data")
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
+ filename="$cache_dir/$(cksum <<< "$first_line")"
+ debug "Writing $data to $filename"
+ printf '%s' "$data" > "$filename"
- last_data[any]=$data
+ debug "Writing $first_line to $cache_file"
+ printf '%s\n' "$first_line" >> "$cache_file"
if (( CM_OWN_CLIPBOARD )) && [[ $selection != primary ]]; then
# Take ownership of the clipboard, in case the original application