kyoheiu / felix

tui file manager with vim-like key mapping
https://kyoheiu.dev/felix/
MIT License
734 stars 26 forks source link

Add support for Viu #183

Closed pergamomo closed 1 year ago

pergamomo commented 1 year ago

Hi!

I couldn't get Chafa to work. Is it possible to integrate Viu? https://github.com/atanunq/viu

Thanks for a great project!

kyoheiu commented 1 year ago

Actually, until v1.1.0 (2022-08) felix had used viuer, which is the backend of viu. I decided the transition to chafa because:

  1. The image-drawing performance is much greater with chafa.
  2. The code maintainability
  3. The number of dependencies (viuer has a lot)

Technically I think it's possible to add viu as an option. Could you tell me in which situation you cannot make chafa work?

pergamomo commented 1 year ago

Sorry, I completely forgot about this. Yes, I'm trying to get previews to work and currently nothing is displayed in the preview area: image

Chafa is working correctly in the terminal: image

But the main reason is that viu displays the image at native resolution. image

Chafa is also great but maybe it would be cool to have both options?

Otherwist I think Felix is a fantastic piece of software that I use daily.

Thanks for reading!

kyoheiu commented 1 year ago

Hm, that seems a bug. Could you share your environment info? (OS, felix & chafa version)

Anyway, I see the reason to implement viu(er) again. I'll give it try! Thank you.

kyoheiu commented 1 year ago

186 Re-implemented the image preview by viuer. It only supports the blocked preview, so if you'd like to see the high-res, you still have to install chafa.

pergamomo commented 1 year ago

Indeed this works! when building from the feature-viuer branch I get previews:

image

Forgive my ignorance - but when using command line why is it that the viu command renders in native resolution:

image

while chafa does not? image

❯ chafa --version
Chafa version 1.8.0

Features: mmx sse4.1 popcnt
Applying: mmx sse4.1 popcnt

❯ viu --version
viu 1.4.0

❯ neofetch
             /////////////                
         /////////////////////            --------------------
      ///////*767////////////////         OS: Pop!_OS 22.04 LTS x86_64
    //////7676767676*//////////////       Host: MacBookPro15,2 1.0
   /////76767//7676767//////////////      Kernel: 6.0.12-76060006-generic
  /////767676///*76767///////////////     Uptime: 1 day, 2 hours, 46 mins
 ///////767676///76767.///7676*///////    Packages: 2233 (dpkg), 18 (flatpak)
/////////767676//76767///767676////////   Shell: zsh 5.8.1
//////////76767676767////76767/////////   Resolution: 2048x1280, 2688x1680, 2688x1680
///////////76767676//////7676//////////   DE: GNOME 42.5
////////////,7676,///////767///////////   WM: Mutter
/////////////*7676///////76////////////   WM Theme: Pop
///////////////7676////////////////////   Theme: Pop-dark [GTK2/3]
 ///////////////7676///767////////////    Icons: Pop [GTK2/3]
  //////////////////////'////////////     Terminal: WezTerm
   //////.7676767676767676767,//////      CPU: Intel i7-8569U (8) @ 4.700GHz
    /////767676767676767676767/////       GPU: Intel CoffeeLake-U GT3e [Iris Plus Graphics 655]
      ///////////////////////////         Memory: 7178MiB / 15846MiB
         /////////////////////
             /////////////

And thanks for looking into this!

kyoheiu commented 1 year ago

Chafa version 1.8.0

This is the root of the problem. felix uses --animate=false option when rendering image with chafa, which is available from chafa v1.10.0. See https://github.com/kyoheiu/felix#integrations If you can update chafa everything will go fine. (If you can see the high-res image in your terminal, felix can do it as well)

FYI, the reason the image is displayed by blocks with viuer in felix, is that the high-res preview of gif animation causes a long time: This actually made me use --animate=false option.

kyoheiu commented 1 year ago

I don't know why viu can show the high-res image and chafa cannot - that is not an issue of felix I guess. But some packages / libraries might be missed. See https://github.com/hpjansson/chafa/issues/113

pergamomo commented 1 year ago

This is the root of the problem. You are right!

image

I had installed Chafa via apt and apparently it contains an old version. After cloning and building the current v1.13.0 it works as expected.

I'm terribly sorry for wasting you time 🙈

I will consider this closed then and thanks for looking into this and helping me out!

kyoheiu commented 1 year ago

Implementing native support for the image preview would be nice idea. I'll dig into this.