Move our plugins into .thumbnailer files
What
Now that we have support for .thumbnailer
files that reside in /usr/share/thumbnailers
, we should start moving our own plugins into such,
so that we're following this de-facto standard other desktop environments do.
This de-facto standard was popularized by GNOME with their thumbnailers for Nautilus:
- https://gitlab.gnome.org/GNOME/gnome-desktop/-/blob/master/libgnome-desktop/gnome-desktop-thumbnail.c
- https://tecnocode.co.uk/2013/10/21/writing-a-gnome-thumbnailer/
Moving these plugins into similar little binaries allows them to
- Working nicer with sandboxing
- Being distributable with flatpaks
- Easing future transitions (KF6 to KF7 for example)
- Works with other file explorers
How
It should be relatively simple process: We make a plugin a QApplication, create a .thumbnailer
file for it, and then tell CMake to install it to ${KDE_INSTALL_DATADIR}/thumbnailers/
Here's the first plugin that I have been moving, which can serve as an example: !368
We could potentially make a macro to make this easier, but I also feel like making the macro is going to take just as long as going the plugins one by one ;) (well, at least for me)
Plugins to move
-
Appimagecreator -
Audiocreator -
Comiccreator -
Cursorcreator !368 -
Djvucreator -
Ebookcreator -
Exrcreator -
Imagecreator -
Merge with jpegcreator -
Merge with svgcreator
-
-
Kritacreator -
Opendocumentcreator -
Textcreator -
Windowsexecreator -
Windowsimagecreator
Note about folders
Folder thumbnails are handled by kio-extras thumbnail.cpp
From directorycreator.cpp
// The actual implementation for directory thumbnails is in thumbnail.cpp
// This class is only a dummy to produce a KPluginMetaData so that the directory thumbnailer is listed by PreviewJob::availablePlugins()
We can just add a separate toggle for this in the settings and simplify this part, but this is why I'm not moving the directory thumbnailer, since it's just a dummy plugin.
Testing
Currently our plugins override the thumbnailer files, so to properly test this, you have to rebuild kio
where in previewjob.cpp
you comment out the following part:
jsonMetaDataPlugins = KPluginMetaData::findPlugins(QStringLiteral("kf6/thumbcreator"));
This makes KIO only look for the standardized thumbnailers and ignore the plugins, so you can test them properly.
Removing the plugins when all is done
This is something I don't know how to do, but we need to somehow get the old plugins out of the systems. Is this distro thing, or something else?