ytfzf
ytfzf copied to clipboard
[BUG]: kitty thumbnail mode broken with kitty-0.27.0
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)
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.
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.
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).
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.
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.
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.
I see that you removed this line from the code. 'scaler' 'fit_contain'
ytfzf won't request to upscale the thumbnail from now?
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.
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.
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.
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.
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:
Notice that the image is cut off weirdly, and the text just says Sc
when it should say Scraping Youtube ...
I feel like your program is rendering behind fzf somehow
That could be an issue with the terminal, with alacritty + sixel patch works fine.
U++ writes directly to the terminal and cleans up the area on exit.
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
.
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?
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.
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?
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.
I meant, fzf without ytfzf, like for general previewing of images. Ytfzf is a wrapper script after all.
How would you go on implementing ueberzug support for fzf?
I'm not sure how I would implement it.
It's alright, I'll think something, thanks.
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.
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.
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
e colocar o comando chafa "$2" no arquivo
depois passar o arquivo zkmod como parametro na hora de rodar o codigo
no fim ficou meio tortinho mas funciona