Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ionenwks opened this issue Jan 31, 2023 · 24 comments
Open

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

ionenwks opened this issue Jan 31, 2023 · 24 comments
Labels
bug Something isn't working

Comments

@ionenwks
Copy link
Contributor

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 ionenwks added the bug Something isn't working label Jan 31, 2023
@Euro20179
Copy link
Collaborator

Euro20179 commented Jan 31, 2023

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.

@n8x0b7T
Copy link

n8x0b7T commented Feb 7, 2023

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.

@Euro20179
Copy link
Collaborator

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).

@jstkdng
Copy link

jstkdng commented Apr 15, 2023

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.

@Euro20179
Copy link
Collaborator

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
Copy link
Collaborator

Euro20179 commented Apr 18, 2023

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.

@jstkdng
Copy link

jstkdng commented Apr 18, 2023

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

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

@Euro20179
Copy link
Collaborator

Euro20179 commented Apr 19, 2023

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.

@jstkdng
Copy link

jstkdng commented Apr 19, 2023

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.

@Euro20179
Copy link
Collaborator

Euro20179 commented Apr 19, 2023

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.

@jstkdng
Copy link

jstkdng commented Apr 19, 2023

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.

@Euro20179
Copy link
Collaborator

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 ...

@jstkdng
Copy link

jstkdng commented Apr 19, 2023

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.

@Euro20179
Copy link
Collaborator

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.

@jstkdng
Copy link

jstkdng commented Apr 19, 2023

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?

@Euro20179
Copy link
Collaborator

Euro20179 commented Apr 19, 2023

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.

@jstkdng
Copy link

jstkdng commented Apr 20, 2023

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?

@Euro20179
Copy link
Collaborator

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.

@jstkdng
Copy link

jstkdng commented Apr 20, 2023

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

@Euro20179
Copy link
Collaborator

How would you go on implementing ueberzug support for fzf?

I'm not sure how I would implement it.

@jstkdng
Copy link

jstkdng commented Apr 20, 2023

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

@jstkdng
Copy link

jstkdng commented May 1, 2023

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.

@Euro20179
Copy link
Collaborator

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

I'd like to move this conversation to this discussion: #674, please respond there.

@MrZkexe
Copy link

MrZkexe commented Jul 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants