NikitaIvanovV / ctpv

Image previews for lf file manager
https://www.nikitaivanov.com/man1/ctpv
MIT License
264 stars 24 forks source link

gifs preview for foot in lf #51

Closed beh-10257 closed 8 months ago

beh-10257 commented 1 year ago

so basically I added

preview gifs .gif {{
    chafa -f sixel -s "$w"x"$h" "$f"
}}

to my ctpv config if I type ctpv filename.gif it will work perfectly but if I try to preview the same gif with lf It will not work

NikitaIvanovV commented 1 year ago

You can try adding exit 1 at the end of your preview. It's needed to prevent lf from caching the preview.

NikitaIvanovV commented 1 year ago

But that is wrong, ctpv is supposed to handle gifs by default, yet it doesn't. The problem is that chafa tries to animate the gif, which doesn't work in lf. I attempted adding an option to the chafa call to disable animation but some users reported that their image previews broke after that. I suspect it's because this option was introduced somewhat recently and many distros still use old versions of chafa.

AFAIK chafa also provides a library, maybe I can statically link it with ctpv and use internally? This way the gif previews will work everywhere and I won't have to rely on whatever chafa version user has installed on their system.

beh-10257 commented 1 year ago

well I wanted the gif to be animated in the first place that's why I got through the hassle of creating my own commands so as I understand lf doesn't support animation right

NikitaIvanovV commented 1 year ago

No, apparently it does not, which is a pity. But maybe you can try ueberzug if you use X11? I used to use it and, if I remember correctly, gifs were animated.

beh-10257 commented 1 year ago

ohh I didn't know that nice since I'm on wayland and I really don't want to switch then I guess I should wait until lf support sixels properly in the first place to ask for this feature request

catb00mer commented 12 months ago

https://github.com/jstkdng/ueberzugpp might help!

It's a drop-in replacement for ueberzug that supports Wayland and gif images.