NikitaIvanovV/ctpv

Better image previews on Wayland

Closed this issue ยท 9 comments

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?

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.

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.

maybe ncls can be a great tool?

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.

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. ๐Ÿ˜…

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.

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?

Guys, I've found a potential solution: #25 (comment)

You need to:

  • Use a terminal that supports sixel format (e.g., foot)
  • Install this fork of lf that supports sixel
  • Update ctpv to the latest commit and add set autochafa option in your ctpv config.