User Tools

Site Tools


tumbler

Table of Contents

Tumbler

Software for rendering thumbnails in file managers.

Directories

Examples

Typical folder.thumbnailer in /usr/share/thunmbnailers:

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

Using the names used above, some example folder-thumbnailer scripts:

folder-thumbnailer
#!/bin/bash
 
if [ -f "$2/.folder.jpg" ]; then
	convert -thumbnail "$1" "$2/.folder.jpg" "$3" 1>/dev/null 2>&1
elif [ -f "$2/.folder.png" ]; then
	convert -thumbnail "$1" "$2/.folder.png" "$3" 1>/dev/null 2>&1
elif [ -f "$2/.folder.svg" ]; then
	inkscape --export-type=png --export-dpi=500 "$2/.folder.svg" --export-filename="$3" 1>/dev/null 2>&1
	convert -thumbnail "$1" "$3" "$3" 1>/dev/null 2>&1
else
	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"
fi

Source: https://aur.archlinux.org/packages/tumbler-folder-thumbnailer/


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

Source: https://bugzilla.xfce.org/show_bug.cgi?id=14576#c77


folder-thumbnailer
#!/bin/bash
 
if [[ $# -lt 4 ]]; then
	echo "$0: size input_file_name output_file_name input_uri"
	exit 255
fi
 
SIZE="$1"
INPUT_FILE_NAME="$2"
OUTPUT_FILE_NAME="$3"
INPUT_URI="$4"
THUMBNAIL="$(echo -n "$INPUT_URI" | md5sum | cut -d " " -f1).png"
 
convert_thumbnail() {
	local filename="$1"
	convert -background none -thumbnail "$SIZE" "$INPUT_FILE_NAME/$filename" "$OUTPUT_FILE_NAME" 1>/dev/null 2>&1
}
 
for directory in ".cache/thumbnails" ".thumbnails"; do
	for subdirectory in "normal" "large"; do
		rm -f "$HOME/$directory/$subdirectory/$THUMBNAIL"
	done
done
 
for name in "folder" "cover"; do
	for extension in "jpg" "png" "svg"; do
		if convert_thumbnail "${name}.${extension}" || convert_thumbnail ".${name}.${extension}"; then
			exit 0
		fi
	done
done
 
exit 1

Source: https://aur.archlinux.org/packages/tumbler-extra-thumbnailers/

See Also

tumbler.txt · Last modified: 2021/05/26 02:17 by rjt