viu
viu copied to clipboard
Integration with fzf
Does anybody know how to integrate the viu with fzf
? My goal it to make fzf
print the pdf cover image in the preview
section. At the moment, my humble code is
function fpp()
{
# open PDF using fuzzy finder with preview
rg --type 'pdf' --files | fzf --preview-window down:80% --preview '
pdftoppm -f 1 -l 1 -singlefile -jpeg -tiffcompression jpeg -- {1} | viu -
'
}
It prompts to
Any help is welcome :)
When I use viu -b
it works though, what is happening?
Yeah, integration with fzf while having the original resolutions of images would be perfect.
It works with -b option to force block output though, but not with the original resolutions.
It may be the problem from fzf's side. Could anyone tell me if it's not caused by viu? So I can make an issue post on fzf's repo.
its kind of both but major factor is fzf. The thing is, is that this works perfectly fine with Ueberzug (which is now out of development but is still the only working option) kitty +kitten icat used to work until last month on kitty terminal when they rebuilt icat to be faster. Fzf draws another buffer and cant display image directly.
It sucks because there is almost nothing that is like fzf that also has the option for previews, let alone image previews. A lot of the choice menus dont give you the index of the item you are on so you cant really make it work in a hacky way. Its weird because I'm not sure how ueberzug is still the only one that works when it was developed as a stop-gap years ago. It seems like this is a very common need but theres nothing that really fills that gap right now, I've been looking for a long time.
@sweetbbak Why/How did Ueberzug
make it work? AFAIK Ueberzug
is permanently out due to harassment... I used to use ueberzug
too.
yea, they are done for good with ueberzug, which is really unfortunate. It does still work though and there is a new project called Ueberzugpp in C++ that is reviving it. It intends to be a drop in replacement for ubz but I was having a few issues compared to the original project when it came to use with fzf. Mainly the image would freeze and not change but I also need more time to figure it out.
I just started using the original one since icat broke with fzf. There are a couple of other projects that are using the Kitty protocol (with kitty and St) and Unicode character placeholders which may fix the issue as well. Right now just using the original ueberzug is the only way I've been able to get it to work. Fzf can only read the escape codes as strings and cant interpret them to images, ubz display over the top of fzf all together