ytfzf icon indicating copy to clipboard operation
ytfzf copied to clipboard

Thumbnails non-functional in Wayland using normal terminal emulators

Open littlediobolic opened this issue 3 years ago • 71 comments

Thumbnails do not display in Wayland using a normal terminal emulator due to ueberzug relying on X. This is obviously an upstream issue but something I feel is worth mentioning. For example gnome-terminal does not work.

I tested in kittyhowever, which has its own image protocol and it does work, but in 99% of terminals it will likely not work by default.

littlediobolic avatar Mar 03 '21 14:03 littlediobolic

We are using ueberzug for image previews. Ueberzug doesn't work well with wayland. We will need to look for other terminal viewers.

pystardust avatar Mar 03 '21 16:03 pystardust

I did a little bit of testing on this. It works on X11 based terminal emulators such as urxvt. Wayland based ones such as terminator don't work. Which has definitely to do with ueberzug being X11 based. Adding an additional option for us Wayland users would be appreciated. PS: @littlediobolic i didn't got it to work with kitty, how did you do that? It's a wayland native app so it shouldn't work, since ytfzf only supports ueberzug and not kittys own protocol.

SamsiFPV avatar Mar 04 '21 10:03 SamsiFPV

@SamsiFPV Terminator is not Wayland based, and thumbnails works very well in Terminator on X11.

napcok avatar Mar 04 '21 10:03 napcok

@napcok wrong wording form my side, i meant it runs in wayland natively. My bad.

SamsiFPV avatar Mar 04 '21 10:03 SamsiFPV

How about we use an external viewer? I was able to make it work with sxiv (any viewer that auto updates when the file changes) . The only caveat is that it wouldn't look great since you have 2 windows, one with names and the other with thumbnails.

pystardust avatar Mar 06 '21 02:03 pystardust

maybe a pretext to re-invent ueberzug but for wayland? could be useful for tons of things

tekakutli avatar Mar 07 '21 07:03 tekakutli

PS: @littlediobolic i didn't got it to work with kitty, how did you do that? It's a wayland native app so it shouldn't work, since ytfzf only supports ueberzug and not kittys own protocol.

@SamsiFPV I did not do anything special to get it working. I just downloaded kitty, ran it, and thumbnails displayed properly. I can send logs if necessary but I am unsure what caused it to work.

littlediobolic avatar Mar 08 '21 15:03 littlediobolic

I would recommend looking at kitty https://sw.kovidgoyal.net/kitty/graphics-protocol.html

tgunnoe avatar Mar 09 '21 02:03 tgunnoe

What about sixel?

Vapourium avatar May 20 '21 12:05 Vapourium

I tried img2sixel and lsix both didnt work but the problem is that fzf interprates input itself and doesnt let the terminal interprate the input, so sixel and anything that draws the image on the terminal itself wont work, w3m could work but the image does not stay on the screen.

Euro20179 avatar May 20 '21 17:05 Euro20179

Try chafa

Vapourium avatar May 20 '21 19:05 Vapourium

#254 adds a few different methods for viewing thumbnails, chafa is one of them, it has been accepted into the development branch, so if you clone the development branch and run ytfzf --thumb-disp-method=chafa it should use chafa for displaying thumbnails (it is a bit laggy but not as laggy as catimg)

I also will probably keep trying to implement w3m since it's a proper image viewer

Euro20179 avatar May 20 '21 19:05 Euro20179

would love sixel support so I can use in sway, with 'foot'. Ranger works well with a sixel patch. Tried chafa, it works, but looks a bit rubbish. Hope sixel gets supported.

duffydack avatar Jun 26 '21 09:06 duffydack

sixel just does not work in fzf, it ends up displaying the actual characters (yes I tried in a terminal that supports sixel).

Euro20179 avatar Jun 26 '21 13:06 Euro20179

Shame. Guess I'll use chafa then, and squint a bit. :)

duffydack avatar Jun 26 '21 13:06 duffydack

Haha, chafa imo is actually decent but not as good as true image viewers ofc. w3m's image viewer might work with fzf but it seems to not stay on the screen for very long.

Euro20179 avatar Jun 26 '21 14:06 Euro20179

Doesn't work on nixos in foot terminal even with this flag ytfzf --thumb-disp-method=chafa

timsofteng avatar Jul 27 '21 18:07 timsofteng

@timsofteng you also need --show-thumbnails

dnkl avatar Jul 28 '21 21:07 dnkl

@timsofteng you also need --show-thumbnails

Thanks! Yes, it works with ansi format. image

P.s is it limitation of fzf? Images in terminal is a big pain... Tmux doesn't suppor sixel as wel...

timsofteng avatar Jul 29 '21 08:07 timsofteng

is it limitation of fzf

yes

Euro20179 avatar Jul 29 '21 14:07 Euro20179

Was anyone able to get it to work with Kitty's icat?

VarLad avatar Aug 26 '21 20:08 VarLad

Did some testing with w3m, learned it's protocol to understand what is happening with this command

printf "%b\n%s\;\n%s\n" "0;1;$x;$y;$width;$height;;;;;$image" 3 4 | w3mimgdispaly

here's the docs (yes this is all i could find)

Basically what I think is happening is, w3m is drawing the image THEN fzf is drawing the preview window, however i also tried using skim and it had the exact same issue.

If anyone knows an fzf alternative/fork that includes the --preview flag I can try it.

My solution to this is to put that line of code in a while true loop so that w3m is always drawn ontop of the preview window, this is a very bad solution, but it works.

Euro20179 avatar Oct 15 '21 06:10 Euro20179

w3m image support has been merged into the rewrite, I wasn't able to find a better way to do it though.

Euro20179 avatar Oct 22 '21 16:10 Euro20179

@Euro20179 Isn't w3m-img X11 specific?

VarLad avatar Oct 22 '21 18:10 VarLad

@VarLad Damn, didn't realize that, tested it on say, yes it's x11 specific. If you can't get thumbnails on wayland with w3m i'm not sure how you can, so this will remain open for the foreseeable future.

Euro20179 avatar Oct 23 '21 02:10 Euro20179

@Euro20179 Can you try out kitty's icat? https://github.com/kovidgoyal/kitty/issues/2238

VarLad avatar Oct 23 '21 06:10 VarLad

I have no idea why I just realized this now, but when i tested w3m on wayland, i tested it in alacritty, in which w3m doesn't work at all, retested it in sway with xterm, and yes w3m works.

TLDR: messed up my testing in wayland, w3m does work in wayland.

Euro20179 avatar Oct 27 '21 00:10 Euro20179

@Euro20179 Its because XTerm runs on XWayland. ueberzug works that way too That runs with Wezterm with Wayland disabled too (which means its using XWayland)

VarLad avatar Oct 27 '21 23:10 VarLad

I was not using XWayland, i ran sway by itself. And to test, i logged into another tty, and launched sway from there. w3m worked, ueberzug did not.

Euro20179 avatar Oct 28 '21 01:10 Euro20179

Thumbnails do not display in Wayland using a normal terminal emulator due to ueberzug relying on X. This is obviously an upstream issue but something I feel is worth mentioning. For example gnome-terminal does not work.

I tested in kittyhowever, which has its own image protocol and it does work, but in 99% of terminals it will likely not work by default.

how did you get images showing with kitty, it is my main terminal and I don't get pictures.

ankkax avatar Dec 23 '21 01:12 ankkax