Skip to main content

Module thumbnails

Module thumbnails 

Source
Expand description

The system’s thumbnails as a preview provider of the file picker (feature thumbnails, off by default; ThumbnailsPlugin, opt-in): for what egui-pop’s own providers do not preview (PDF, office documents, videos, fonts…), the thumbnail the desktop made or can make.

Experimental: may change in any release (docs/stability.md).
  • Linux and the BSDs: the freedesktop thumbnail cache ($XDG_CACHE_HOME/thumbnails, a thumbnail kept only while its Thumb::MTime is the file’s), then the installed thumbnailers (thumbnailers/*.thumbnailer in the XDG data folders), run for the file’s MIME type (the shared MIME database’s globs) into a temporary file, stopped after a timeout or when the selection moves. The cache is read, not written.
  • Windows (the shell’s thumbnail cache) and macOS (QuickLook) are not done yet: the provider says so as its reason.
  • The web: nothing; the provider passes.

It runs at the lowest priority (-100), after every other provider, and only on the system’s file system (a MemoryFs has no paths the desktop knows).

use egui_pop_api::files::FilesPlugin;
use egui_pop_api::App;
use egui_pop_platform::thumbnails::ThumbnailsPlugin;

let app = App::builder()
    .plugin(FilesPlugin::in_app())
    .plugin(ThumbnailsPlugin::default())
    .build(&egui::Context::default())
    .unwrap();
let files = app.handle().service(&egui_pop_api::files::FILES).unwrap();
assert!(files.previews().providers().iter().any(|(id, _)| id == "egui_pop.system_thumbnails"));

Structs§

SystemThumbnails
The system’s thumbnails, as a preview provider.
ThumbnailsPlugin
Registers SystemThumbnails with the files plugin.

Constants§

PLUGIN
The plugin’s id.
PROVIDER
The provider’s id.

Functions§

available
Whether this platform has system thumbnails here: why not, if not.
file_uri
A path as a file:// URI, escaped as GLib does (g_filename_to_uri): what the thumbnail cache is keyed by.
md5_hex
MD5 (RFC 1321), for the thumbnail cache’s file names.
png_texts
A PNG’s text chunks (tEXt), keyword and text.