Following https://bugzilla.xfce.org/show_bug.cgi?id=12528 and https://docs.xfce.org/xfce/thunar/tumbler On Manjaro XFCE 18.1 RC3, I tried to have txt thumbnails with [Thumbnailer Entry] Version=1.0 Encoding=UTF-8 Type=X-Thumbnailer Name=txt Thumbnailer MimeType=text/plain; Exec=/usr/bin/convert -thumbnail %s %i %o But it fails, as well as for: * webm * html (html5 in case it matters) * markdown(which can be converted to html5 before) NOTE pamac says I have Thunar-gtk3 1.8.7-3 installed, but Thunar in About show "1.8.5git-8c4cd0" Thanks
Thunar does not fail in this case. It is tumbler that cannot generate a thumbnail for those files, because /usr/bin/convert only accepts image files. You will have to use a different program or write your own one for this purpose.
> tumbler that cannot generate a thumbnail for those files, because /usr/bin/convert only accepts image files. It's not what I achieved, see below. >You will have to use a different program or write your own one for this purpose. Well, KDE Dolphin supports preview of text files I'm a beginner, but I test some scripting concepts: For text base files it could be something such as: iFile=$(<"testSomeTextFile.md") iChopped="${iFile:0:1600}" unset iFile echo "${iChopped}" > "tmp.txt" unset iChopped convert -size 210x290 -background white -pointsize 5 -border 10x10 -bordercolor "#CCC" caption:@"tmp.txt" "testSomeTextFile.png" This shows it's possible to create a thumbnail for any text base file, and one could even have option to distinguish file types (md, txt, css, etc) by changing either: - font colour, - background color or - border colour. - or having an image overlay (such as it's so nicely done currently). Regarding html, depending on CPU ressources, one could go an extra step and interpreter the html in such a way: iFile=$(<"test.htm") iChopped="${iFile:0:3200}" unset iFile echo "${iChopped}" > "test.htm" unset iChopped wkhtmltoimage "test.htm" --width 260 --height 260 test.png
You can use the desktop thumbnailer and create a custom thumbnailer to accomplish this. First, create the file /usr/share/thumbnailers/text.thumbnailer with the following content: [Thumbnailer Entry] Version=1.0 Encoding=UTF-8 Type=X-Thumbnailer Name=Text Thumbnailer MimeType=text/plain;text/html;text/css; Exec=/usr/local/bin/textthumb %s %i %o *add any other MimeTypes that you would like covered to the MimeType line Second, create the file /usr/local/bin/textthumb with the following content: #!/bin/bash iFile=$(<"$2") iChopped="${iFile:0:1600}" unset iFile echo "${iChopped}" > tmp.txt unset iChopped convert -size 210x290 -background white -pointsize 5 -border 10x10 -bordercolor "#CCC" caption:@"tmp.txt" "$3" rm tmp.txt *make this file executable. Restart tumbler and you should get text thumbnails. (Note: depends on tumbler 0.2 or greater).
@ToZ Thanks for the script ! If you tested it, could you please add it to https://docs.xfce.org/xfce/thunar/tumbler ? ( I as well can do so, if you prefer ) Afterwards I guess we can close this bug
Added to the tumbler wiki entry.
(In reply to ToZ from comment #5) > Added to the tumbler wiki entry. Great, thanks !