ytfzf icon indicating copy to clipboard operation
ytfzf copied to clipboard

[BUG]: kitty thumbnail mode broken with kitty-0.27.0

Open ionenwks opened this issue 2 years ago • 24 comments

Describe the bug

Unsure for exact cause, but doesn't display anything anymore and no error messages I can see.

kitty-0.27.0 made several changes which notably makes image viewing faster, drops ImageMagick requirement for common formats, and there's also a quicker-to-launch /usr/bin/kitten icat someimage.png (albeit kitty +kitten icat can still be called), but guess(?) that with the changes it's now confused when ran under fzf (using icat directly, or seeing kitty-based previews in e.g. ranger still works).

I experimented with different options/transfer-modes (including the new memory one) but haven't managed to make it work again. If you don't have better luck than me, I'm ok with the fix being to deprecate support (ideally would probably need a custom helper to display using the kitty protocol without the icat demo, but sounds not-so-trivial and even then not sure if it'd integrate with fzf easily).

To reproduce

ytfzf -t -T kitty somesearch

Information

  • OS: Gentoo
  • Terminal: kitty-0.27.0
  • Ytfzf version: 2.5.4
  • Output of ls -l "$(which sh)" (if you're using fish: ls -l (which sh)): /bin/sh -> bash
  • (if is a thumbnail issue) run ytfzf --thumbnail-log=log.txt and post the file: (no file was created)

ionenwks avatar Jan 31 '23 15:01 ionenwks

Can't get it to work, but i got it to work with my interface that i made for sixel because fzf also doesn't support sixel. (note that this menu is not great, extremely basic).

I'll probably make that manu an addon since it now has 2 features fzf doesn't.

Also, deprecating here doesn't sound useful because it just straight up doesn't work, might just have to remove it.

Euro20179 avatar Jan 31 '23 16:01 Euro20179

I did a bit of digging and this part of the documentation details how to display images. https://sw.kovidgoyal.net/kitty/kittens/icat/#icat I tested this in kitty 0.27.0 I'm probably not fully understanding the problem.

n8x0b7T avatar Feb 07 '23 03:02 n8x0b7T

I'm probably not fully understanding the problem.

The problem is that displaying images doesn't work nicely with fzf (after kitty v0.27.0).

Euro20179 avatar Feb 07 '23 03:02 Euro20179

Might I interest you in my project? https://github.com/jstkdng/ueberzugpp

It is a drop-in replacement for ueberzug but has aditional features such as sixel and kitty support. It already works OOB with ytfzf and supporting sixel/kitty should be simple, you'd only need to pipe ytfzf's stdout with ueberzugpp's stdout.

jstkdng avatar Apr 15 '23 00:04 jstkdng

I am interested, I will check this out at some point, however this is currently not my project of focus, so that may be a while.

Euro20179 avatar Apr 15 '23 04:04 Euro20179

Might I interest you in my project? https://github.com/jstkdng/ueberzugpp

This indeed does work OOB with ytfzf, I have added it to the readme as a dropin replacement for ueberzug.

Euro20179 avatar Apr 18 '23 21:04 Euro20179

I see that you removed this line from the code. 'scaler' 'fit_contain'

ytfzf won't request to upscale the thumbnail from now?

jstkdng avatar Apr 18 '23 23:04 jstkdng

I removed it because it was upscaling channel thumbnails to be the size of the terminal, idk why, but nothing else seems different when i remove it, if Im wrong please correct me.

Euro20179 avatar Apr 19 '23 02:04 Euro20179

nvm, the scaling isn't important. What's important is how to pipe U++ stdout to fzf's. If you need any help or have advice please do say so.

jstkdng avatar Apr 19 '23 05:04 jstkdng

What's important is how to pipe U++ stdout to fzf's

From what I can tell, this works out of the box without me changing anything, do you mind testing it?

To test it, just download your program, and run ytfzf -t -T ueberzug search

Also, I have no idea how you managed to make sixel and kitty work with fzf, I'm impressed, this allows me to finally add a generic sixel option!

update: I have added a sixel thumbnail option, and have readded kitty, but it now requires ueberzugpp. These changes are in the development branch.

Euro20179 avatar Apr 19 '23 14:04 Euro20179

I have tested those outputs and they work as expected.

I'm surprised fzf works as most terminal programs don't like their cursor being move around by another program.

jstkdng avatar Apr 19 '23 16:04 jstkdng

I'm surprised fzf works as most terminal programs don't like their cursor being move around by another program.

Not only that, sixel doesn't work straight up in fzf in the first place. for example, if i did the same thing but with chafa, it would just display raw sixel output and not an image.

I feel like your program is rendering behind fzf somehow, as when i exit fzf, the text that was printed to the console previously gets messed up. example: image

Notice that the image is cut off weirdly, and the text just says Sc when it should say Scraping Youtube ...

Euro20179 avatar Apr 19 '23 18:04 Euro20179

I feel like your program is rendering behind fzf somehow

That could be an issue with the terminal, with alacritty + sixel patch works fine.

image

U++ writes directly to the terminal and cleans up the area on exit.

jstkdng avatar Apr 19 '23 18:04 jstkdng

That could be an issue with the terminal, with alacritty + sixel patch works fine.

Ah, interesting, in case you're curious, i'm using foot.

Euro20179 avatar Apr 19 '23 18:04 Euro20179

oh really, I always thought foot's sixel implementation was the best.

You should open an issue with them if that always happens on foot, does the issue appear on kitty on your side as well?

jstkdng avatar Apr 19 '23 18:04 jstkdng

does the issue appear on kitty on your side as well?

I think it did earlier, but i was unable to reproduce it, Im going to try again later.

edit: tried again, can't reproduce it. Seems to be unique with foot.

Euro20179 avatar Apr 19 '23 19:04 Euro20179

well then, I guess this issue can be closed.

if i did the same thing but with chafa, it would just display raw sixel output and not an image.

yeah, it seems fzf just destroys escape codes. How would you go on implementing ueberzug support for fzf?

jstkdng avatar Apr 20 '23 00:04 jstkdng

How would you go on implementing ueberzug support for fzf?

I'm not sure what you mean, it already works.

There was an issue on fzf about making it work with sixel, however it seems to have been closed due to no one wanting or knowing how to implement it.

Euro20179 avatar Apr 20 '23 05:04 Euro20179

I meant, fzf without ytfzf, like for general previewing of images. Ytfzf is a wrapper script after all.

jstkdng avatar Apr 20 '23 05:04 jstkdng

How would you go on implementing ueberzug support for fzf?

I'm not sure how I would implement it.

Euro20179 avatar Apr 20 '23 15:04 Euro20179

It's alright, I'll think something, thanks.

jstkdng avatar Apr 20 '23 16:04 jstkdng

I have added support for the iterm2 image protocol to ueberzugpp, I've tested it in wezterm with ytfzf and it works fine. It should work on MacOS's iterm2 as well.

jstkdng avatar May 01 '23 23:05 jstkdng

I've implemented this, and in wezterm it just infinitely loads.

I'd like to move this conversation to this discussion: https://github.com/pystardust/ytfzf/discussions/674, please respond there.

Euro20179 avatar May 02 '23 15:05 Euro20179

a minha solução foi instalar o chafa ir na pasta" ~/.config/ytfzf/thumbnail-viewers criar um arquivo chamdo zkmod e dar permissão de execucção para ele screenshot-20240703-141414 e colocar o comando chafa "$2" no arquivo screenshot-20240703-141552

depois passar o arquivo zkmod como parametro na hora de rodar o codigo screenshot-20240703-141835 no fim ficou meio tortinho mas funciona screenshot-20240703-141958

MrZkexe avatar Jul 03 '24 17:07 MrZkexe