flxzt / rnote

Sketch and take handwritten notes.
https://rnote.flxzt.net
GNU General Public License v3.0
8.37k stars 293 forks source link

.rnote file preview in file managers #53

Open astrosticks opened 2 years ago

astrosticks commented 2 years ago

Screenshot from 2022-01-21 14-02-04

It would be nice to be able to see some sort of preview of .rnote files from a file manager. Would help the files be recognizable apart from just their filenames.

D0V4HKIIN commented 1 year ago

I have seen this being done with stl files (3d models) and it is actually pretty awesome to have

zefr0x commented 3 months ago

We already have a CLI interface to export the content as PNG. We can use it just to export the first page to act as the thumbnail. But the problem is that its not built by default, so can we provide this functionality to rnote-ui as a CLI option?

The reset is easy, we just need a .thumbnailer file in /usr/share/thumbnailers/ like:

[Thumbnailer Entry]
TryExec=/usr/bin/rnote
Exec=/usr/bin/rnote --export-thumbnail %i %o
MimeType=application/rnote;

Reference: https://askubuntu.com/questions/1368910/how-to-create-custom-thumbnailers-for-nautilus-nemo-and-caja

Also, there must be a strict security policy for this functionality, since if something went wrong it will be a "just look at the file arbitrary code execution vulnerability"

Doublonmousse commented 3 months ago

We could have the thumbnail saved as a png inside of the rnote file (and having the thumbnailer be a simpler lookup to this pre existing data). We could do this upon a change of the file format.

Not sure if this has drawbacks though (this would mean a simpler logic for the thumbnailer so maybe it'd be easier to make it secure but we may have larger file sizes as a result ?)

I'd be great to have this over all platforms we currently target (that means linux, windows and mac os).

For linux, ideally this would work on most DE (so gnome and KDE), unfortunately a thumbnailer for gnome won't work for KDE. Hopefully supporting these two is enough for the rest to work on linux (??)

There may be some information to be found in other github repository that are dedicated to being thumbnailers on different OS : https://github.com/Arlorean/Voxels, https://github.com/unlimitedbacon/stl-thumb and https://github.com/unlimitedbacon/stl-thumb-kde

zefr0x commented 3 months ago

Not sure if this has drawbacks though (this would mean a simpler logic for the thumbnailer so maybe it'd be easier to make it secure but we may have larger file sizes as a result ?)

Also, with this you will have a performance overhead every time you save your work.