initial commit of Thunar-folder-icons trick

This commit is contained in:
Agent725 2025-11-08 16:30:48 +01:00
parent ce695d38ca
commit b653966146
3 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,116 @@
HOWTO: MAKE CUSTOM FOLDER ICONS
Find some cool icons in /usr/share/icons/... and get to work!
Tested in LM Xfce 19.3 we was on ubuntu 18.04 and on thunar 1.6.15.
Now, that we are on LM 20 xfce and on thunar 1.8.14 ... we are able to show custom folder icons in thunar.
(Might be useful for music-collections - or image-collections ... e.g.)
As shown on the xfce4 website we will need two scripts to do it.
I will show you the way i got it to work (without the use of terminal)
1. open up thunar and create a folder in your home-directory and name it like "mythunarfiles" (without quotes) ... or whatever you want.
2. open up xed and copy the first script to it :
Code: Select all
#!/bin/bash
convert -thumbnail "$1" "$2/cover.jpg" "$3" 1>/dev/null 2>&1 ||\
convert -thumbnail "$1" "$2/.icon.png" "$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
3. save the script as :
Code: Select all
folder-thumbnailer
to the folder home/yourname/mythunarfiles
4. now copy the second script to xed :
Code: Select all
[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
5. save the script as :
Code: Select all
folder.thumbnailer
to the folder home/yourname/mythunarfiles
Open up thunar and
home/yourname/mythunarfiles
Open up a new thunar window
6. navigate to > filesystem > usr > bin
7. make a right click on the folder and choose "open as root"
8. Drag and drop the file
Code: Select all
folder-thumbnailer
from the thunar-window home/yourname/mythunarfiles to the window /usr/bin (which is now opened with root-privilegues.)
9. now do a right click on the file folder-thumbnailer (that now sits in /usr/bin/
and choose > Properties> Access rights and mark: "File can be started as a program"
10. close the Folder
11. navigate to > filesystem > usr > share > thumbnailers.
12. now do a right click on the folder and choose "open as root"
12. Drag and drop the file
Code: Select all
folder.thumbnailer
from the thunar-window home/yourname/mythunarfiles to the window /usr/share/thumbnailers (which is now opened with root-privilegues.)
13. now do a right click on the folder.thumbnailer (that now sits in /usr/share/thumbnailers
and choose > Properties> Access rights and mark: "File can be started as a program"
14. close the folder.
15. Very important :
to get it to work : you must install imagemagick
Code: Select all
apt install imagemagick
16. Now restart the system
17. And now restarted :
...... if you place a jpg-image with the name :
cover.jpg
or
.icon.png
into a folder ..... the folder icon will show it .
And if you delete the file thunar will show the "normal" file icon again ...

View File

@ -0,0 +1,8 @@
#!/bin/bash
# Creates a custom icon for folder based on hidden .folder.png file.
convert -thumbnail "$1" "$2/.icon.png" "$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

View File

@ -0,0 +1,7 @@
[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=Folder Thumbnailer
MimeType=inode/directory;
Exec=/home/user/.local/bin/folder-thumbnailer %s %i %o %u