pystardust / ytfzf

A posix script to find and watch youtube videos from the terminal. (Without API)
GNU General Public License v3.0
3.78k stars 343 forks source link

[BUG]: swayimg thumbnail backend not working in alacritty+sway #681

Open kevenwyld opened 1 year ago

kevenwyld commented 1 year ago

Describe the bug

Thumbnails are not working in sway using alacritty and swayimg.

To Reproduce

run ytfzf -t -T swayimg something

Expected behavior

Thumbnails are shown

Screenshots

20230620_22h19m12s_grim

Information

Additional context

I was previously using hyprland before running sway. I saw in the code there is a note:

swayimg-hyprland thumbnail viewer may mess up any rules you have for swayimg

I'm not sure what this means though, or whether it is permanent messing up or temporary. Thumbnails in hyprland using the swayimg-hyprland backend did work though.

Euro20179 commented 1 year ago

not gonna lie, swayimg might simply be broken because I dont maintain it.

Try installing ueberzugpp from the aur, and using ytfzf -T sway

I'll look into fixing the thumbnail log problem.

kevenwyld commented 1 year ago

not gonna lie, swayimg might simply be broken because I dont maintain it.

That's totally fair, it's a lot to maintain support for multiple window managers that you probably don't personally use. I've been trying to figure it out on my own too but haven't made much progress yet.

Try installing ueberzugpp from the aur, and using ytfzf -T sway

I tried ueberzugpp from the aur and it still doesn't render thumbnails. I used ytfzf -t -T sway. I also finally got a thumbnail log file to be generated by setting the option in the config file however the file is empty in this particular case.

It kinda feels like the whole thumbnail function isn't running. I put some debugging echo statements in load_thumbnail_viewer and preview_display_image . preview_display_image never runs with either backend.

EDIT: That last part is wrong, disregard that.

kevenwyld commented 1 year ago

I just tried the development branch which has some changes the arch git package hasn't gotten yet. No change though.

Euro20179 commented 1 year ago

Keep ueberzugpp installed and try ytfzf -t -T wayland, if that doesn't work i'll try doing some debugging myself.

tylerdq commented 11 months ago

Keep ueberzugpp installed and try ytfzf -t -T wayland, if that doesn't work i'll try doing some debugging myself.

I can confirm that this works. Notably, I was having OP's same issue but on Void Linux. When I ran into dependency hell trying to build ueberzugpp from source on Void I decided to install Bedrock Linux so I can have an Arch stratum alongside my Void stratum and use pacman to install ueberzugpp via the AUR.

It would be great to have an alternative for others who may want high-res thumbnail support with Void/Sway/Alacritty/Swayimg but aren't willing to take the path I chose.

Euro20179 commented 11 months ago

It would be great to have an alternative for others who may want high-res thumbnail support

Previously I had supported kitty without ueberzugpp but it broke, and wasn't sure how to fix it.

fzf does not support sixel, nor the kitty protocol, so in order to do either some hacks have to be done described below.

Here's how I think it would have to be done:

  1. create a process that listens for when a new image should be displayed (either sixel or kitty), and display it
    1. This process should be started in preview_start
  2. in preview_display_image notify the process to draw an image.

The reason I think it needs to be done this way is so that the process connects to the terminal, instead of fzf's emulated terminal.

Even so I'm not certain this would work.

I don't particularly feel like implementing this, if someone else wants to give it a shot they can.

Maybe if I'm really bored one day I'll try it, because not relying on ueberzugpp would be nice.

umop3plsdn commented 11 months ago

it's strange i'm on hyprland and have ueberzugpp installed from the AUR as well and no matter what I do I cannot get thumbnails even though I use other programs with ueberzugpp support such as lobster and those thumbnails work. I did try -Twayland as suggested up the thread and that does work but if i move the ytfzf terminal window the thumbnail viewer does not stay with it and just remains in the same spot. I've even tried using swayimg-hyprland and swayimg with swayimg installed. nogo.

Euro20179 commented 11 months ago

I've even tried using swayimg-hyprland and swayimg with swayimg installed. nogo.

What's wrong with swayimg?

but if i move the ytfzf terminal window the thumbnail viewer does not stay with it and just remains in the same spot

The thumbnail should move when you select a new item.

It's not really possible to move it by itself.

tylerdq commented 11 months ago

The thumbnail should move when you select a new item.

I can confirm this works for me when using -T wayland. The thumbnail does not follow the window when it moves but does update its location correctly when I select a new item. Personally, my use case does not really involve moving the window though.

umop3plsdn commented 11 months ago

The thumbnail should move when you select a new item.

I can confirm this works for me when using -T wayland. The thumbnail does not follow the window when it moves but does update its location correctly when I select a new item. Personally, my use case does not really involve moving the window though.

oh nice you're right it does update if you change the thumbnail. Ya my use case doesn't really involve moving the window either.. I just happened to do it and noticed it stayed right there. I guess as long as -T wayland works for me I don't really care if the others don't work either