Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
xfce:thunar:tumbler [2015/10/05 23:21] ochosixfce:thunar:tumbler [2019/04/23 13:00] – [Customized Thumbnailer for folders] toz
Line 42: Line 42:
  
 After creating the rc file, it is best to log off and on again to restart Thunar and Tumbler, because both applications cache the mime-type combinations. After creating the rc file, it is best to log off and on again to restart Thunar and Tumbler, because both applications cache the mime-type combinations.
 +
 +===== Customized Thumbnailers =====
 +As of version 0.2.0, the desktop thumbnailer functionality has been added back into tumbler. This functionality supports custom .thumbailer files placed in the /usr/share/thumbnailers folder.
 +
 +==== Customized Thumbnailer for .dds files ====
 +
 +For example, to create a custom thumbnailer for .dds files, do the following:
 +  - Create the appropriate .thumbnailer file:<file txt /usr/share/thumbnailers/dds.thumbnailer>
 +[Thumbnailer Entry]
 +Version=1.0
 +Encoding=UTF-8
 +Type=X-Thumbnailer
 +Name=dds Thumbnailer
 +MimeType=image/x-dds;
 +Exec=/usr/bin/convert -thumbnail %s %i %o
 +</file>
 +  - Ensure that a dds mimetype exists in your system (you can view mimetypes with the Xfce4 Mime Type Editor). If it does not exist, create the necessary mime file:<file txt ~/.local/share/mime/packages/dds.xml><?xml version="1.0" encoding="UTF-8"?>
 +<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
 +    <mime-type type="image/x-dds">
 +        <comment>dds file</comment>
 +        <icon name="image"/>
 +        <glob-deleteall/>
 +        <glob pattern="*.dds"/>
 +    </mime-type>
 +</mime-info></file>...and run "update-mime-database ~/.local/share/mime".
 +
 +==== Customized Thumbnailer for folders ====
 +
 +Another example are albums cover thumbnails for folders in a music collection. Starting with thunar 1.8.2 a custom thumbnailer can be added to e.g. add a file  ''folder.jpg'' or ''cover.jpg'' into a folder and display its thumbnail instead of the default folder icon:
 +<file txt /usr/share/thumbnailers/folder.thumbnailer>
 +[Thumbnailer Entry]
 +Version=1.0
 +Encoding=UTF-8
 +Type=X-Thumbnailer
 +Name=Folder Thumbnailer
 +MimeType=inode/directory;
 +Exec=/usr/bin/folder-thumbnailer %s %i %o %u
 +</file>
 +
 +In order to support different names for the picture-file and to remove the thumbnail if not needed any more (display the default folder icon) , a separate script is required:
 +
 +<file sh /usr/bin/folder-thumbnailer>
 +#!/bin/bash
 +
 +convert -thumbnail "$1" "$2/folder.jpg" "$3" 1>/dev/null 2>&1 ||\
 +convert -thumbnail "$1" "$2/.folder.jpg" "$3" 1>/dev/null 2>&1 ||\
 +convert -thumbnail "$1" "$2/folder.png" "$3" 1>/dev/null 2>&1 ||\
 +convert -thumbnail "$1" "$2/cover.jpg" "$3" 1>/dev/null 2>&1 ||\
 +rm -f "$HOME/.cache/thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
 +rm -f "$HOME/.thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
 +rm -f "$HOME/.cache/thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
 +rm -f "$HOME/.thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
 +exit 1
 +</file>
 +
 +Note: imagemagick is a required dependency for this script.