File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # requires imagemagick to generate thumbnails
4-
5- thumbnail_size=64
63thumbnail_dir=" ${XDG_CACHE_HOME:- $HOME / .cache} /cliphist/thumbnails"
74
85cliphist_list=$( cliphist list)
96if [ -z " $cliphist_list " ]; then
10- fuzzel -d --placeholder " cliphist: please store something first" --lines 0
7+ fuzzel -d --prompt-only " cliphist: please store something first "
118 rm -rf " $thumbnail_dir "
129 exit
1310fi
1411
1512[ -d " $thumbnail_dir " ] || mkdir -p " $thumbnail_dir "
1613
17- # Write square shaped thumbnail to cache if it doesn't exist
14+ # Write binary image to cache file if it doesn't exist
1815read -r -d ' ' thumbnail << EOF
1916/^[0-9]+\s<meta http-equiv=/ { next }
2017match(\$ 0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) {
2118 cliphist_item_id=grp[1]
2219 ext=grp[3]
2320 thumbnail_file=cliphist_item_id"."ext
24- system("[ -f ${thumbnail_dir} /"thumbnail_file" ] || echo " cliphist_item_id "\\\\ \t | cliphist decode | magick - -thumbnail ${thumbnail_size} ^ -gravity center -extent ${thumbnail_size} ${thumbnail_dir} /"thumbnail_file)
21+ system("[ -f ${thumbnail_dir} /"thumbnail_file" ] || echo " cliphist_item_id "\\\\ \t | cliphist decode > ${thumbnail_dir} /"thumbnail_file)
2522 print \$ 0"\0icon\x1f${thumbnail_dir} /"thumbnail_file
2623 next
2724}
You can’t perform that action at this time.
0 commit comments