Folder thumbnails in Thunar
My favorite file manager is Thunar, but it hasn’t folder thumbnails by default.
Here’s how to enable it.
- Install tumbler and imagemagick
1yay -S tumbler imagemagick
- Create the following a folder.thumbnailer file and add the following
1sudo vi /usr/share/thumbnailers/folder.thumbnailer
1[Thumbnailer Entry]
2Version=1.0
3Encoding=UTF-8
4Type=X-Thumbnailer
5Name=Folder Thumbnailer
6MimeType=inode/directory;
7Exec=/usr/bin/folder-thumbnailer %s %i %o %u
- Create the folder-thumbnailer script
1sudo vi /usr/bin/folder-thumbnailer
1#!/bin/bash
2
3convert -thumbnail "$1" "$2/folder.jpg" "$3" 1>/dev/null 2>&1 ||\
4convert -thumbnail "$1" "$2/.folder.jpg" "$3" 1>/dev/null 2>&1 ||\
5convert -thumbnail "$1" "$2/folder.png" "$3" 1>/dev/null 2>&1 ||\
6convert -thumbnail "$1" "$2/cover.jpg" "$3" 1>/dev/null 2>&1 ||\
7rm -f "$HOME/.cache/thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
8rm -f "$HOME/.thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
9rm -f "$HOME/.cache/thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
10rm -f "$HOME/.thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
11exit 1
1sudo 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.