------------------------------------------------------------------------------- Thumbnailing... (Gnome Environment) ------------------------------------------------------------------------------- Thumbnail Cache filename To convert a filename into the thumbnail cache filename you need to convert the md5 checksum of its URI, then append ".png" For example.. file="/home/anthony/t.txt" file_uri="file://$file" iconname=`echo -n "file://$file" | md5sum - | sed 's/ .*/.png/'` iconfile="$HOME/.cache/thumbnails/normal/$icon" If the icon generation filed a special file is placed in $HOME/.cache/thumbnails/fail/{factory}/$icon For gnome nautilus the factory is "gnome-thumbnail-factory" which is why clearing the ".thumbnails" directory and restarting nautilus completely between each text can be important. ------------------------------------------------------------------------------- Nautilus (Gnome-3) Thumbnailers export XDG_DATA_HOME="$HOME/.local/share/" # default value export XDG_DATA_DIRS="$XDG_DATA_HOME:/usr/local/share/:/usr/share/" Create a file "$XDG_DATA_HOME/thumbnailers/text.thumbnailer" See XDG Base Directory Specification https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html =======8<-------- [Thumbnailer Entry] MimeType=text/plain;text/x-log;text/x-log; Exec=bin/thumbnailers/text %i %o =======8<-------- The command is executed from the launch directory of nautilus (your home) as such can be made relative to that home. The "[Thumbnailer Entry]" and the ".thumbnailer" suffix IS REQUIRED. Note using %i and %o escapes you get plain and simple filenames for the thumbnail conversion making it much simplier to create your own thumbnailers. %o typically points to Hashed image filenames in the directory... "$XDG_CACHE_HOME/thumbnails/normal" where XDG_CACHE_HOME defaults to "$HOME/.cache" so the path is normally.. "$HOME/.cache/thumbnails/normal" See above if you want to know the hashing method, though not normally needed. For example this "image.thumbnailer" uses the ImageMagick "convert" command directly to generate a fairly sophisticated image resized thumbnail with a border and padding. =======8<-------- [Thumbnailer Entry] MimeType=MimeType=image/gif;image/jpeg;image/png;image/x-xpixmap;image/x-xbitmap;image/vnd.microsoft.icon; Exec=/bin/convert %i'[0]' -thumbnail 46x46\> -border 1x1 -gravity center -background white -extent 48x48 png:%o =======8<-------- Remember "convert" can basically handle just about ANY image file format! But as you can see a dedicated script would probably work better due to the complexity of a thumbnail generator. In fact my own image thumbnailer (based on the above) is rather more complex with better handling of transparency. For more information onusing the ImageMagick convert command to create different styles of thumbnails see... http://www.imagemagick.org/Usage/thumbnails/ ------------------------------------------------------------------------------- Nautilus (Gnome-2) Thumbnailing... Install schema for the thumbnailer... gconftool-2 --install-schema-file \ $HOME/bin/gnome_thumbnails/text-thumbs.schemas This installs multiple mime entries like... =======8<--------CUT HERE---------- /schemas/desktop/gnome/thumbnailers/text@plain/enable /desktop/gnome/thumbnailers/text@plain/enable text-thumbs bool true /schemas/desktop/gnome/thumbnailers/text@plain/command /desktop/gnome/thumbnailers/text@plain/command text-thumbs string /home/anthony/bin/gnome_thumbnails/text-thumbs %u %o =======8<--------CUT HERE---------- The "text-thumbs" program then generates PNG thumbnail using the given URIs. For this script decodes the URI's and calls a "text" thumbnailer script. Note the output file is PNG but may not have a 'png' suffix. See also "Gnome.hints" on the Thumbnail cache ------------------------------------------------------------------------------- Thunar 1.2 (DBus) Thumbnailer For standard non generated icons the theme can be set by creating a "~/.gtkrc-2.0" file with the line giving the primary theme name. gtk-icon-theme-name="Tango" Note the theme will still fall bacj to "hicolor" theme regardless. For generated thumbnails you need a DBus thumbnailer in XDG_DATA_DIRS/dbus-1/services a file needs to have something like... =======8<-------- [D-BUS Service] Name=org.freedesktop.thumbnails.Thumbnailer1 Exec=your-thumbnailerd =======8<-------- Adding a cache interface is optional: "org.freedesktop.thumbnails.Cache1" The application Tumler provides this. See http://live.gnome.org/ThumbnailerSpec It points the "Exec=" entry to the executable... /usr/lib/tumbler-1/tumblerd User defined thumbnailers are currently not available. Is there some other DBus thumbnailer that can be used instead of "tumbler"? One that allows extra or overriding, user defined thumbnail generators, just as Gnome allows? -------------------------------------------------------------------------------