wm: drop cliphist-wofi

parent e9d51797
......@@ -13,9 +13,6 @@ The set of utilities used in Ximper Linux includes various tools that help speed
Script for automatically starting applications that support XDG Autostart.
Necessary for window managers that do not support this specification.
### cliphist-wofi
Script for displaying clipboard menu with image support via wofi.
## License
MIT License
......
#!/bin/bash
wofi_flags="$*"
thumb_dir="${XDG_CACHE_HOME:-$HOME/.cache}/cliphist/thumbs"
mkdir -p "$thumb_dir"
cliphist_list="$(cliphist list)"
for thumb in "$thumb_dir"/*; do
clip_id="${thumb##*/}"
clip_id="${clip_id%.*}"
check=$(rg <<< "$cliphist_list" "^$clip_id\s")
if [ -z "$check" ]; then
>&2 rm -v "$thumb"
fi
done
read -r -d '' prog <<EOF
/^[0-9]+\s<meta http-equiv=/ { next }
match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) {
image = grp[1]"."grp[3]
system("[ -f $thumb_dir/"image" ] || echo " grp[1] "\\\\\t | cliphist decode | magick - -resize '256x256>' $thumb_dir/"image )
print "img:$thumb_dir/"image
next
}
1
EOF
choice=$(gawk <<< "$cliphist_list" "$prog" | wofi -I --dmenu -Dimage_size=100 -Dynamic_lines=true $wofi_flags)
[ -z "$choice" ] && exit 1
if [ "${choice::4}" = "img:" ]; then
thumb_file="${choice:4}"
clip_id="${thumb_file##*/}"
clip_id="${clip_id%.*}\t"
else
clip_id="${choice}"
fi
printf '%s' "$clip_id" | cliphist decode
......@@ -2,7 +2,7 @@ prefix ?= /usr
bindir ?= $(prefix)/bin
DESTDIR ?=
EXECUTABLES = wm-xdg-autostart cliphist-wofi
EXECUTABLES = wm-xdg-autostart
all: install
......
......@@ -35,7 +35,6 @@ Group: Graphical desktop/Other
%files -n %pkgprefix-wm
%_bindir/wm-xdg-autostart
%_bindir/cliphist-wofi
%changelog
* Sun Dec 22 2024 Kirill Unitsaev <fiersik@altlinux.org> 0.2.0-eter1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment