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

XDG-thumb for preview & thumbs for non-image files #537

Merged
merged 1 commit into from
May 20, 2024

Conversation

DLFW
Copy link
Contributor

@DLFW DLFW commented May 6, 2024

This implements a cache for thumbnails and image previews for non-image file formats, like videos and PDFs.
This patch extends the inbuilt image preview feature (285df85) by integrating the allmytoes crate and using its thumbnails instead of the actual file being previewed.

The image-preview feature uses the XDG-(freedesktop.org-) specified thumbnail-cache to re-use existing thumbs and to store newly created thumbs.
(https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html)

This increases performance for the image-preview because the preview does not need to load the full-sized version of the image and does not need to scale it down every time, once the thumbnail has been created. Also, thumbnails are now shared with other programs that use the XDG-thumb cache.

Furthermore, the new way to obtain thumbs allows to show image-previews for file types other than images. Existing thumbnails are shown for any file type. New thumbnails can be created for many video formats, PDF files, Postscript files, and SVGs. Users can also add “providers” for other file-types by configuring allmytoes.

The XDG-thumb feature can be disabled, and the thumbnail-size can be changed, both in joshuto.toml. The documentation has been extended, the whole image-preview page has been enhanced a little.

This implements a cache for thumbnails and image previews for non-image
file formats, like videos and PDFs.
This patch extends the inbuilt image preview feature (285df85) by
integrating the `allmytoes` crate and using its thumbnails instead of
the actual file being previewed.

The image-preview feature uses the XDG-(freedesktop.org-) specified
thumbnail-cache to re-use existing thumbs and to store newly created
thumbs.
(https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html)

This increases performance for the image-preview because the preview
does not need to load the full-sized version of the image and does not
need to scale it down every time, once the thumbnail has been created.
Also, thumbnails are now shared with other programs that use the
XDG-thumb cache.

Furthermore, the new way to obtain thumbs allows to show image-previews
for file types other than images. Existing thumbnails are shown for any
file type. New thumbnails can be created for many video formats, PDF
files, Postscript files, and SVGs. Users can also add “providers” for
other file-types by configuring `allmytoes`.

The XDG-thumb feature can be disabled, and the thumbnail-size can be
changed, both in `joshuto.toml`. The documentation has been extended,
the whole image-preview page has been enhanced a little.
@DLFW
Copy link
Contributor Author

DLFW commented May 6, 2024

Disclaimer: I'm the author of AllMyToes.

Two notes on this:

  • AllMyToes is currently GPL licensed. As I'm the author, I sill dare to provide this PR, even though Joshuto is LGPL. 🙂 I will eventually change the license soon, most probably to MIT.
  • I have never tested AllMyToes on Mac and I have no idea if that works. If MacOS does not use a "magic" database for mime-types like Linux does, it will probably not work. Mac users would need to switch off this feature. If there are Mac users around, I would appreciate some feedback.

Clippy's failure in the pipeline seems not to be related to the changes in this PR but because of the latest Rust update to 1.78.0.

Copy link
Owner

@kamiyaa kamiyaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is really neat!
AllMyToes is a really cool project and I'll probably use it myself lol.

@kamiyaa kamiyaa merged commit e458ac3 into kamiyaa:main May 20, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants