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

Thumbnails not in the position that should be in ST(simple terminal) #466

Closed engjpacheco closed 2 years ago

engjpacheco commented 2 years ago

The thumbnails apperas upper the rectangle of preview overlapping the text, and a bit smallers. I use the image preview ueberzug. Other functionalities works just fine.

Thanks.

Euro20179 commented 2 years ago

The thumbnails apperas upper the rectangle of preview overlapping the text,

Show a screenshot? however a lot of the time the image will overlap the description if it is long. I've tried fixing this by auto shifting the thumbnail down when the thumbnail is long, but this causes bugs.

engjpacheco commented 2 years ago

Maybe is normal as you say, let me upload a screenshoot later, cus' im on work.

engjpacheco commented 2 years ago

pic-selected-220117-1732-48 it seems that thumbnails dont appear, but is weird because last week or so works fine, just the position that I mentioned in the issue.

Euro20179 commented 2 years ago

it seems that thumbnails dont appear

try killall ueberzug, and killall ytfzf try deleting ~/.Xauthority and restarting Xorg.

engjpacheco commented 2 years ago

Try it but same result,

engjpacheco commented 2 years ago

Screenshot_20220118-083328_Telegram.jpg Here is another picture that proof that thumbnails works but overlapping the text, but since yesterday that I check ytfzf now the thumnbnails disapears

Euro20179 commented 2 years ago

I think it has to do with the fact that the preview doesn't take up the full height of the screen, do you have any fzf opts set that would make it do that?

Also I'm not sure why thumbnails stopped working randomly, have you updated ytfzf since yesterday?

engjpacheco commented 2 years ago

Noup, i inky download the repo and install as the readme says. Ex ytfzf -t

And i didn't update ytfzf.

Euro20179 commented 2 years ago

You could try bash ytfzf ... You could also try updating ytfzf but i doubt that'll fix anything

git clone https://github.com/pystardust/ytfzf
cd ytfzf
sudo make uninstall-old
sudo make install doc

Sometimes thumbnails stop working for me too, and it's usually when i've fiddled with ueberzug, or used another script with it. I'm not sure how to fix it and sometimes it just fixes itself. I'm also nto sure why the preview is like that, but you could add this to your config

get_ueberzug_positioning_left () {
    width=$1
    height=$(($2-10))
    x=2
    y=15
}

get_ueberzug_positioning_right() {
    width=$1
    height=$(($2-10))
    x=$(($1+6))
    y=15
}

You can fiddle around with the y variable.

engjpacheco commented 2 years ago

Allright gonna check that out, thanks for the quick response this project is awesome btw.

Regards.

Euro20179 commented 2 years ago

ramble

@engjpacheco Found something quite interesting, for one, this bug is quite similar to the second half of #94. Number 2, both of you have weird leftover commandline text at the top. I was browsing the fzf manpage and stumbled accross the --height option, when i set it to something like 50%, the same weird leftover commandline text would appear for me.

possible solution

On line 1198 after --expect="$shortcut_binds" add --height=100

or use this patch, which does the same thing.

diff --git a/ytfzf b/ytfzf
index 6ccd8a5..146f40d 100755
--- a/ytfzf
+++ b/ytfzf
@@ -1195,7 +1195,7 @@ interface_thumbnails () {
        sort_video_data_fn |
        fzf -m \
        --preview "__is_fzf_preview=1 fzf_preview_side='$fzf_preview_side' thumb_dir='$thumb_dir' YTFZF_PID='$YTFZF_PID' UEBERZUG_FIFO='$UEBERZUG_FIFO' $0 -U preview_img '$thumbnail_viewer' {} '$video_json_file'" \
-       --preview-window "$fzf_preview_side:50%:wrap" --layout=reverse --expect="$shortcut_binds" | set_keypress |
+       --preview-window "$fzf_preview_side:50%:wrap" --height=90 --layout=reverse --expect="$shortcut_binds" --height=100 | set_keypress |
        trim_url > "$selected_id_file"

        preview_stop "$thumbnail_viewer"
engjpacheco commented 2 years ago

Hi, just try unimstall it and reinstalling and adding the patch but no good results, im going to figure it out, maybe is something wrong with my st, but is weird because it used to works 20220119_093712.jpg

Euro20179 commented 2 years ago

Hi, just try unimstall it and reinstalling and adding the patch but no good results, im going to figure it out, maybe is something wrong with my st, but is weird because it used to works

Although the thumbnails aren't showing, they should be in the right position now (which is what i was trying to fix)

but is weird because it used to works

Ueberzug is very funky.

Ideas

engjpacheco commented 2 years ago

Allright thank you, I install ueberzug without sudo so its ok i guess, I also try it in xmonad same result, maybe is something with ueberzug, i dont know maybe in a few days or so is gonna be working i guess, thank you again.

shervinsahba commented 2 years ago

My thumbnails would clip the preview text when my default FZF_DEFAULT_OPTS setting included --height=80%. Increasing the height to the full terminal prevented clipping.

engjpacheco commented 2 years ago

I remember see that env variable in my zprofile, im gonna check that out but i dont know why thumbnails dont appear since las month or so, thanks for the tip.

Euro20179 commented 2 years ago

That variable is no longer used in ytfzf, since 2.0, but in the 2.2 beta versions there is a --fzf-opts option though.

Not sure if you use the kitty terminal, but the kitty thumbnail viewer addon is very very stable, you could download it, and put it in ~/.config/ytfzf/thumbnail-viewers, and use --thumb-viewer=kitty or put thumbnail_viewer=kitty in your config.

@engjpacheco if you want to try debugging this more, try downgrading ytfzf to version 1.2, the ONLY way i can replicate ueberzug not working is changing the format of the information that it recieves. The format was changed in 2.0. If it works, i'll either: a) have to find a way to get it to work with different formats b) use both formats since a lot of people use the new format.

engjpacheco commented 2 years ago

Ok, im gonna downgrade an try ( i use st) if not i can live without thumbnails i guess.. thanku

Euro20179 commented 2 years ago

if not i can live without thumbnails i guess.. thanku

you could use imv, it's a seperate window, but at least it's thumbnails. You'll probably be able to install it w/ package manager

shervinsahba commented 2 years ago

That variable is no longer used in ytfzf, since 2.0, but in the 2.2 beta versions there is a --fzf-opts option though.

Interesting. My FZF_DEFAULT_OPTS seems to be respected by ytfzf (version 2.1.rc-4) on my system. I'm only calling ytfzf -t --thumb-viewer=<option> <search terms>. The menu that opens has all my fzf styles intact.

The thumbnail seems to be placed with respect to the terminal size and not the fzf "window", which is why the height change back to 100% worked for me. The kitty-viewer script is nice by the way. It let me get rid of my ueberzug dependency. The same thumbnail placement issues occurred with both ueberzug and kitty for me, though.

Let me know if I can add more info. I'm happy with how it works though! Nice work.

Euro20179 commented 2 years ago

. My FZF_DEFAULT_OPTS seems to be respected by ytfzf (version 2.1.rc-4) on my system

Interesting. This means that fzf just uses this by default, and there is no need for fzf_opts or fzf_thumbnail_opts. I'll do some testing to be sure though.

The thumbnail seems to be placed with respect to the terminal size and not the fzf "window", which is why the height change back to 100% worked for me.

fzf reports it's window size as 2 environment variables: FZF_PREVIEW_COLUMNS and FZF_PREVIEW_LINES, the placement is based on those 2 variables. If you want to see the placement "algorithm" (not really an algorithm), see lines 1298-1333

engjpacheco commented 2 years ago

20220305_161125.jpg

Solved whit the patch with st propped patched too, not the one that I have before, another build of st

Euro20179 commented 2 years ago

nice!

wesleyjrz commented 1 year ago

screenshot-20221224-194734

screenshot-20221224-195252

I was facing the same problem with st, termite and tym. Then I set FZF_DEFAULT_OPTS to include --height=100% (It was set to 40% before) and it worked.