🐧 Folder thumbnails in Thunar

2019/08/13 by Paulo Pereira

~/categories/Linux #Linux #Arch Linux #Thunar

My favorite file manager is Thunar, but it hasn’t folder thumbnails by default.

Here’s how to enable it.

yay -S tumbler imagemagick
sudo vi /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
sudo vi /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
sudo chmod +x /usr/bin/folder-thumbnailer

To add a thumbnail to a folder you just need to add a .folder.jpg file and your set. You can decide to use different names in the /usr/bin/folder-thumbnailer script.

More information here https://docs.xfce.org/xfce/thunar/tumbler.