Skip to content

Commit

Permalink
contrib: add fzf with sixel images example
Browse files Browse the repository at this point in the history
closes #84
  • Loading branch information
sentriz committed Feb 14, 2024
1 parent 9128c08 commit 54f1c05
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions contrib/cliphist-fzf-sixel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

case "$1" in
preview)
row="$2"
if echo "$row" | grep -vqP '^\d+\t\[\[ binary data .* \]\]'; then
echo "$row" | cliphist decode
else
echo "$row" | cliphist decode | chafa -f sixel -s "${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}"
fi
;;

*)
id="$(cliphist list | dmenu clipboard 2 "$(realpath "$0") preview {}")"
test -z "$id" && exit

cliphist decode <<<"$id" | wl-copy
;;

esac

0 comments on commit 54f1c05

Please sign in to comment.