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

[Feature Request] alternate folder view: preview all media thumbnails at once #2224

Open
andykais opened this issue Jan 12, 2021 · 11 comments
Open
Labels
enhancement help-wanted image-preview wants-async Use cases that would be improved by proper async support to facilitate decisions on adding async wontfix

Comments

@andykais
Copy link

andykais commented Jan 12, 2021

Runtime Environment

  • Operating system and version: arch linux
  • Terminal emulator and version: urxvt
  • Python version: 3.9
  • Ranger version/commit: 1.9.3.143.g5047d9e5-1
  • Locale:

Current Behavior

image previews are only shown when hovering over a specific file. This does not give a good overview of everything that is in a folder.

Context

searching for an image in a folder based on its content (rather than its name) requires slowly stepping over each file, waiting for a preview to generate, and repeat.

Its also harder to get a recollection of what a folder contains. For example, if I have several folders with all containing shots from a camera, file names may be very similar. Its hard to get an idea of what I was shooting without seeing several images in a row. Usually I resort to opening geeqie or a similar image viewer which includes thumbnails in these situations.

Possible Solutions

If ranger had a "thumbnail mode" like most file managers do (see an example of nautilus below)
image
Then it would become much easier to search for a specific file by its content

Remaining Questions

  1. Is this even possible? I am not a dev on this project, and I dont even know how ranger draws to the terminal. I dont know how difficult it will be to draw images and text in a similar spot on the screen
  2. Will ranger require some sort of async rendering? I have noticed that ranger can freeze up when trying to create a preview of a particularly large file. This problem would likely be multiplied if multiple thumbnails need to be generated at once

[edit] this feature request was written, perhaps, in response to this hacker news post https://news.ycombinator.com/item?id=25719796 😅

@toonn
Copy link
Member

toonn commented Jan 12, 2021

While maybe technically possible. All the methods of drawing images to the screen are somewhat kludgy. So this sounds like inviting pain to me. (It'd still be cool to show off as a gimmicky demo though : > )
Showing a collection of thumbnails is still best left to image viewers.

However, if you really feel like scratching this itch you're always welcome in #ranger to talk about it and ask for help grokking the codebase.

@toonn toonn added enhancement help-wanted image-preview wants-async Use cases that would be improved by proper async support to facilitate decisions on adding async wontfix labels Jan 12, 2021
@toonn
Copy link
Member

toonn commented Jan 15, 2021

@chu4ng, they're already using image viewers as an alternative.

@mikesbytes
Copy link

This issue hasn't gotten any attention in a while, has anyone investigated this further?

Kitty's graphics protocol should make the rendering aspect fairly trivial and said protocol is supported by several different terminals now, so the main hurdles would be writing the new GUI code, and handling the actual asynchronous thumbnail generation. I'm a pretty new ranger user but I might see if I can throw something together when I have the time.

@markus-bauer
Copy link
Contributor

markus-bauer commented May 9, 2022

@mikesbytes

I just want to mention, that I also have started work on this.
It only works with the kitty protocol and it draws thumbnails in the normal browserview.
2022-05-09_17-09

The speed is no issue at all, since I cache the thumbnails and kitty can just draw the files directly.
There are some other issues, but it works at least as well as the other image stuff.
Since I don't have much time at the moment (for this at least), I don't know if I will finish it (although I plan to).

By the way, If there's interest I can also upload the current version. Just know, that this was hacked together as an experiment.

@andykais
Copy link
Author

andykais commented May 9, 2022

very cool, I would be interested in the implementation (purely to sate my curiosity, Im not a ranger dev 😅)

@markus-bauer
Copy link
Contributor

markus-bauer commented May 12, 2022

Okay, here it is:
https://github.com/markus-bauer/ranger/tree/experiment-thumbnails

You can find more details and how to use it here:
https://github.com/markus-bauer/ranger/blob/experiment-thumbnails/thumbnails.md

If there are questions or something doesn't work at all, please post it here.
As I said, this is an experiment and it's not finished. So keep this in mind.

I went through it again and fixed some stuff. But there are problems, I'm sure. The mix of ranger's codebase + curses is not fun to work with.
I really don't know how much I'm going to work on this. Ranger seems to be in a weird state, at the moment. There's not a lot of activity by the maintainer(s). And I'd rather work on my own projects than on ranger.

@markus-bauer
Copy link
Contributor

markus-bauer commented Feb 11, 2023

By the way, if anyone finds this. I'm not working on this anymore, because ranger's ui and image drawing is too messy.
Anything you add makes it more flickery and unresponsive.
It is possible though to build smooth thumbnail support, at least for kitty. I know this, because I'm working on something else, that does something similar (not public).

So I would consider this a successful experiment. The idea is good, the feature is very useful, and it's doable in kitty. The problem is the quality of ranger's existing code.

Also, I'm wondering if there's any interest in this. There were no responses to my code. Not even "I tried it but it doesn't work".

@Kreijstal
Copy link

By the way, if anyone finds this. I'm not working on this anymore, because ranger's ui and image drawing is too messy. Anything you add makes it more flickery and unresponsive. It is possible though to build smooth thumbnail support, at least for kitty. I know this, because I'm working on something else, that does something similar (not public).

So I would consider this a successful experiment. The idea is good, the feature is very useful, and it's doable in kitty. The problem is the quality of ranger's existing code.

Also, I'm wondering if there's any interest in this. There were no responses to my code. Not even "I tried it but it doesn't work".

is this sixel?

@markus-bauer
Copy link
Contributor

@Kreijstal
No one is working on this anymore. It was just a proof of concept and was never finished.

But no, it was done using the kitty protocol.

@vide0hanz
Copy link

@markus-bauer I'm interested in this, though my initial need was for something more specific: music directories.

I was originally thinking something similar to the existing function in scope.sh to view the first image inside of archives, only instead it'd try to determine if the selected directory contained an audio file with embedded album artwork and attempt to draw a preview of it using ffmpegthumbnailer, but aside from your experiment there doesn't appear to be an easy way to make this generic - it'd have to be pretty specific to check for certain conditions unique to my environment I'd think.

@markus-bauer
Copy link
Contributor

@vide0hanz I think you're talking about something else.
There is/was a PR to preview directories as if they were files (in the right column) using scope:
#2157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help-wanted image-preview wants-async Use cases that would be improved by proper async support to facilitate decisions on adding async wontfix
Projects
None yet
Development

No branches or pull requests

7 participants
@mikesbytes @toonn @Kreijstal @andykais @markus-bauer @vide0hanz and others