NikitaIvanovV / ctpv

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

Better image previews on Wayland #14

Closed brccabral closed 1 year ago

brccabral commented 2 years ago

Hi, lf on wayland uses chafa not ueberzug, thus the preview has low resolution. Changing the login to Xorg it seems to use ueberzug and preview has good resolution. But I don't know what software is causing the issue. Where is the problem? On ueberzug, on wayland, on lf or on ctpv?

NikitaIvanovV commented 1 year ago

Ueberzug is Xorg only, it's not supported on Wayland. You can try using Kitty terminal, it supports normal image rendering on Wayland. I know that there are some protocols that other terminals use for rendering images on Wayland, I will look into how to implement those into ctpv.

donbex commented 1 year ago

I know that there are some protocols that other terminals use for rendering images on Wayland, I will look into how to implement those into ctpv.

If it helps, Wezterm supports the iTerm image protocol and comes with a an example renderer utility like icat.

dragove commented 1 year ago

maybe ncls can be a great tool?

NikitaIvanovV commented 1 year ago

Many terminals seem to support Sixel format but lf, for which ctpv was written, doesn't support it.

There was an attempt to add support for Sixel to lf but it didn't work out.

NikitaIvanovV commented 1 year ago

I've switched to Wayland recently. Just letting you know, 'cause it means that I am now more motivated to find a solution for this problem. :sweat_smile:

dragove commented 1 year ago

Actually, previews do work on xwayland terminals like alacritty, kitty, urxvt, etc. But on "wayland only" terminals such as foot, I still have issues with previewing.

For wayland, you can use kitty, kitty's icat utility can help you to preview images. Also, wezterm supports iTerm2 inline images protocol. I don't know if other terminal emulators have similar things.

I tested ncls and chafa in foot terminal, ncls has better color however it is not as good as it in other terminal emulators.

NikitaIvanovV commented 1 year ago

But on "wayland only" terminals such as foot, I still have issues with previewing.

Could you please elaborate which issues you have when using foot? Image previews are low resolution or don't work at all?

NikitaIvanovV commented 1 year ago

Guys, I've found a potential solution: https://github.com/NikitaIvanovV/ctpv/issues/25#issuecomment-1325711574

You need to:

NikitaIvanovV commented 1 year ago

Fixed! See docs on how to setup here: https://github.com/NikitaIvanovV/ctpv/blob/0c882097f672b8d07c96f95296d904f3d5a81083/README.md#wayland