-
Notifications
You must be signed in to change notification settings - Fork 629
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
[REQUEST] generic file/entry preview #1936
Comments
That's exactly the example theme I had in mind to use previews. I think something like KDE dolphin thumbnailer would be needed, to render images of many file types on the fly. |
It seems that an all in one thumbnail generator library does not exists as of today. I studied a bit rofi source code and what I understood is that icons in filebrowser mode are generated if the file shown is recognized to be an image or if it's a directory, while in drun mode the icon name is instead loaded from the .desktop file. A little improvement for filebrowser mode could be to load a mimetype icon for every entry shown instead of only for directories. I understand that this could be very hard to implement and maybe deviate too much from the intended use cases of rofi, I would be happy to try and contibute some code if this feature is welcome. |
Best place I think is to add it to rofi-icon-fetcher (https://github.com/davatorium/rofi/blob/next/source/rofi-icon-fetcher.c#L380).. This is what queries an internal db for the image and does an async fetch if not found. Currently it either uses libnkutils-xdg-themes to lookup the icon, or renders a font, or tries to open it directly from the disk. F.e. we could prefix with |
To keep compatibility with the xdg standard, and benefiting of cached thumbnails generated by file managers, the prefix to use should be I found a portable C md5 generator that could be included and used without licensing problems md5-c, to avoid having to link with OpenSSL. Based on the requested size of the thumbnail, the image can be found in one of the following directories:
If the thumbnail image is found it can be provided as icon_path to the icon_fetcher_worker, otherwise a thumbnailer script must first be triggered to generate the thumbnail, placing it in the correct folder as described above. For this we need the mime-type of the file of which the thumbnail is requested, I'm dumping all these infos here as a memento for when I have some time to experiment with the code, sorry for the noise. |
That is not exactly what I wanted to say... to tell the icon fetcher to get a thumbnail, we could have a prefix so it knows what to do. It does not mean we do not follow the xdg standard for hashing and looking up. |
yes |
One little thing that crossed my mind while polishing the code: when fetching the mimetype thumbnail for ".desktop" files, it would be nice to instead read their "Icon=" key and display that as thumbnail. These files are usually hidden from the user inside .local/share/applications or /usr/share/applications, and they display their icon just fine when browsed using drun mode, but in some cases (such as mine) users will keep some .desktop files on their Desktop for easy access, like is done in windows (I know, bad habits die hard), so they will be shown also in filebrowser mode. What do you think? |
I think that would be a nice 'extra'. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Before opening a feature request
What is the user problem or growth opportunity you want to see solved?
Currently entries can display an icon, it would be nice if this worked also for previewing text files or showing video thumbnails, like fzf-preview.
It would be even nicer if the user could provide a custom script to generate the preview (like fzf does). For example I have an RSS news reader made with rofi, when an entry is hovered it could show text or images from the web page of the article.
How do you know that this problem exists today? Why is this important?
It would improve many different use cases of rofi
Who will benefit from it?
People using rofi as file manger/chooser and many others
Rofi version (rofi -v)
1.7.5
Configuration
https://gist.github.com/Bond-009/b4b16435c6fd5f21338ccd8144a9b770
Additional information
No response
The text was updated successfully, but these errors were encountered: