-
Notifications
You must be signed in to change notification settings - Fork 326
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
Image preview using ueberzug #134
Comments
I couldn't get ueberzug to work at all, not sure if it works with Kitty tho. |
@TeddyDD It works with kitty. source "`ueberzug library`"
{
ImageLayer::add [identifier]="example0" [x]="0" [y]="0" [path]="/some/path/some_image0.jpg"
read
} | ImageLayer
It runs as a seperate process and takes commands via stdin, so it can be used with any language.
That won't work as ueberzug needs to keep running. |
@seebye |
I don't use lf. I just tried to answer your post. |
@seebye Thanks for the explanation. It looks like an interesting project indeed. I'm glad to see someone working on supporting tmux for image displays. At some point, I have tried to see if On the lf side, I'm still hesitant add support for image display programs. I find terminal images cool and fun but I don't have a strong motivation to work on issues regarding this. I personally rarely work with images on my linux machine and when I do I will mark this issue as a question just in case people want to share some hacks and ideas. |
I understand your hesitation @gokcehan, it would take some work to get it working like in ranger, but I'd really like if it was possible to make it work on the user side.
|
@EmmChriss Height is already passed to preview scripts. We can also pass width to the script. Though x and y is a little tricky since I think it is not possible to determine the position according to the terminal window when using tmux. Also I think one needs to determine the font size and convert these values to pixel sizes to use in |
Favoring ueberzug, and ease of implementation, terminal cell positions should be enough. |
It does not. W3M draws on the same window (/ the terminal window) which leads to race conditions.
That's true. Even if process attachments are implemented there's still an issue left: |
Now that you mention it, removing images on app execution is really tricky. |
I don't know how lf implements launching a program / shell, #!/usr/bin/env sh
remove_image_command
target_program=$(...)
exec "$target_program" "$@" Edit: I think changing E.g. #!/usr/bin/env sh
remove_image_command
exec bash
I think it's easier to add an option to disable the cache, (Also I just want to remember that this implementation isn't possible till process attachment is implemented.) |
Hi, just to give some hope check this VIDEO out! |
Hello again!
In a practical scenario, The problems are that I'm not sure how to listen to these events from lf except adding. Would it be possible to handle all of that only from configurations scripts or the source must be modified? |
Hey, nice script. In lf you can execute arbitrary shell code on initialization by adding
Or you could use the |
Thanks, cool! |
@Naheel-Azawy Sorry for late reply. I wanted to try it for myself before I make a comment here. I have now tried this with your As you also mention, currently we have the following issues:
Overall, 1 and 2 seems easy and I may have some time in the weekend to push these changes. I think we can leave 3 as it is for now. 4 is somewhat complicated and it may require some thinking before doing some changes. |
@gokcehan Seems very promising! One more thing that I forgot! Is there a way to get the rations form And btw, since you're here, I have to say thank you! I was using ranger, nnn, fff, and even nautilus at the same time and all were terrible in a way or another. You saved my environment! |
@Naheel-Azawy Ahh sorry, my bad. I forgot we don't have
This is not as pretty but it should work.
I forgot to mention this in the previous post. So let's call this our 5th issue. And I also realize we have another issue with resizing.
In the meantime, I have been looking at caching and it seems that this is not as straightforward as I imagined. There are a lot of places in the code that we try to load the file from the cache. Also it is even more complicated because we also check the modification time at the same time to see if the file has been changed or not. For example, when we disable cache for a file, To be honest, I started to feel a little overwhelmed by these issues. Even if we fix some of these, it still requires a lot of configuration for casual users and we won't be able to provide an out-of-the-box experience like ranger. External programs will probably be snappier than this approach. There will probably be glitches and we are probably going to introduce some bugs in the code which will effect users not interested in image previews. And I think this still won't work on ssh connections. It seems to me like too much trouble for very little gain. |
This would be cool but I think it would be much easier if there's simply a way to get the values of the options somehow from
I don't find this as a very big deal at the moment. Perhaps call the previewer script with some flags whenever on image and resized? I think we can leave this for later anyway.
Not sure but what I did just for testing is that I removed everything in
Is this somehow so wrong? Wouldn't it be some thing like
I was amazed when I first found this issue when you clearly stated that image previews are not planned to be features in the readme! I kind of agree with you. And btw, my idea was that once this finishes is to add some binding to toggle image previews as I don't always need them. But sometimes I do need them. LF is my main file browser on my main machine so surely I need this. |
@Naheel-Azawy For caching, we don't want to disable it altogether. We only want to do this selectively for erroneous previews. As you said, it is something along the line I'm not saying these things are impossible to fix, just that we need to spend some time to review the code to do this right. I'm currently working on builtin copy/move operations which I think is more prior to this issue. Maybe after that I can return to this issue again. In the meantime, if someone wants to tackle this, feel free to do so. It may take me a while to respond here or review the PR but I should eventually be able to do so. For caching, ideally you should have come up with a solution to In the long term, I feel like it is wiser to keep the "image previews" entry in non-features section in the readme as we would not want to create false expectations for new users. I agree that we should have this in our wiki with scripts and configs. Maybe it would be better to have a separate page for image previews which may also include ascii/unicode based solutions. |
Hey guys, since this is pretty much the single issue that tracks any kind of image preview hacks, I'd like to share with you mine. It's rather simple, it doesn't involve ueberzug in anyway so I hope this is not too much off-topic but I'd like to hear your comments never the less. There's this kind of popular image viewer, called sxiv. It doesn't include tons of features and I don't like much it's development style but it's pretty good. One of it's features is the This feature allows you to put an executable in I use this feature along with Lf's Unfortunately, and this is why I said I don't like Here's my #!/bin/sh
case "$1" in
"C-x")
while read file; do
lf -remote "send select '$file'"
lf -remote "send toggle"
done
;;
esac I haven't actually given attention to what ueberzug has to offer and what scripts the nice people here have wrote in the attempt to actually make it useful for |
Hello, Regarding the preview of images i might have found a solution using the kitty terminal. The only issue i have right now is having some coordinates to tell kitty how to resize the bigger pictures. Also, minor bug that i still have to figure out. |
@ghyatzo i got this working with kitty and icat using this
pv.sh:
|
@elhenro yeah, i've encountered the same issues while playing with it. Great catch on the place function, but still. A bit wonky since it is an absolute position and size, anchored to the top left corner. Anyway, other than not firing on directories, i get that the images are not reloaded after i previewed all the images in a folder i'm stuck with the last image until i preview another kind of file (and the clear function gets called again ). |
@ghyatzo yeah, it is still wonky. I tried using the |
Probably using |
finally got image (and pdf, epub etc) previews working with lf in kitty terminal with ueberzug using cirala's lfimg |
Has anyone tried https://github.com/posva/catimg https://github.com/hzeller/timg https://github.com/atanunq/viu these on wayland? As normal image previewers don't really work. Viu seemed to work best for me. I am not sure how to pass proper sizing to such a program from lf to size it properly. |
I confirm the If anyone is interested, see my |
Can confirm aswell. I've written up a little recipe on how to set up https://github.com/slavistan/howto-lf-image-previews |
i follow steps but when i try to run |
@Monirzadeh You have to use the latest git version and build |
For anyone following this thread, image patch is now merged and a new release r19 is tagged with the patch. Example preview scripts can be found in Previews wiki page. Thanks to contributors for their effort and patience. |
@gokcehan Finally! This took a while but certainly worth it. Have a nice day! |
Note for any LF newbies coming from Google like myself, this is super easy to install and does the job: https://github.com/slavistan/lf-gadgets/tree/master/lf-ueberzug. |
Did anybody try image previews using ueberzug (https://github.com/seebye/ueberzug)? It seems like a very well written tool, but I don't how much Go and Python integrate together. I tried to just bruteforce it into my preview script but it didn't work (showed blank screen or error messages from ueberzug).
The text was updated successfully, but these errors were encountered: