You are not logged in.
Pages: 1
I have added a custom directory to user-dirs.dirs (Books in this case) and would like it to have a special icon like the other "user dirs". The icon theme I use, Papirus, has a suitable icon for it (folder-green-books is the icon name), which I would like it to use. However, unlike the other directories, Thunar is only showing the default folder icon in the folder view as well as in the "Places" in the sidebar. Is there any way I can get it use the other icon?
I am using Linux Mint 21.2, Thunar 4.18.4 and the stated Papirus icon theme.
Last edited by BleepBloop225 (2023-10-31 21:32:45)
Offline
Hello and welcome.
xdg-user-dirs only supports a small subset of folders (see ~/.config/user-dirs.dirs). To enable custom folder icons, look at the tumbler custonimzed folder thumbnails.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
That is a shame, but I shall try your suggestion. Thanks for the help!
Offline
Followed your and the site's instructions, and still its functionality remains a bit unclear to me. Any further help would be appreciated.
I installed Tumbler and added the folder.thumbnailer and folder-thumbnailer files in their respective locations. I copied the file I wish to use as thumbnail (folder-green-books.svg) to the destination directory (Books). Then I changed the folder-thumbnailer file:
covers=("$2"/{.,}{folder,cover}.{jpg,png})
to
covers=("$2"/{.,}{folder-green-books}.{svg})
I marked the script executable, restarted Thunar/my PC multiple times and even ran the script manually, yet nothing happens.
Am I misunderstanding the docs and not using it correctly? What should I do to get it working?
Last edited by BleepBloop225 (2023-10-27 07:22:01)
Offline
I think there may be an error in the "folder.thumbnailer" file thats listed in the wiki. Can you change the last line to read:
Exec=sh -c '~/bin/folder-thumbnailer %s %i %o %u'
Also, if you want to process svg files, simply add it to the list of extensions in the ~/bin/folder-thumbnailer file (also rename your file to just "folder.svg" for ease in processing). Like this:
covers=("$2"/{.,}{folder,cover}.{jpg,png,svg})
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
After all of those actions the folder icon still has not changed. Any further advice?
Offline
Can you post back:
ls -l ~/.local/share/thumbnailers
ls -l ~/bin
cat ~/.local/share/thumbnailers/folder.thumbnailer
cat ~/bin/folder-thumbnailer
Also, can you run tumbler in debug mode and post the output back as well.
Note: I'm testing this on a Mint 21.2 VM and its working - there must be a typo somewhere.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Now I'm even more confused; without changing anything, now it suddenly seems to work. Don't know what's happening or why but I'll take it.
However, it seems the plugin doesn't handle transparency very well (or I have done something wrong again) as this is the result:
Also, is it possible to get different icons for the sidebar in case the directory is pinned there (I'd like to have a symbolic one there to fit with the others)?
Still, here is the output of the commands you posted:
total 4
-rw-rw---- 1 user user 166 Oct 27 19:26 folder.thumbnailer
total 4
-rwxrwx--x 1 user user 409 Oct 28 19:19 folder-thumbnailer
[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=Folder Thumbnailer
MimeType=inode/directory;
Exec=sh -c '~/bin/folder-thumbnailer %s %i %o %u'
#!/bin/bash
covers=("$2"/{.,}{folder,cover}.{jpg,png,svg})
for f in "${covers[@]}"; do
[ -f "$f" ] && {
cover=$f
break
}
done
if [ -z "$cover" ] || ! convert -thumbnail "$1" "$cover" "$3"; then
gdbus call --session --dest=org.freedesktop.thumbnails.Cache1 --object-path /org/freedesktop/thumbnails/Cache1 \
--method org.freedesktop.thumbnails.Cache1.Delete "['$4']" >/dev/null
fi
And here is the debug mode log (I only took the part that appeared when entering the directory in question):
tumbler-xdg-cache-DEBUG: 10:33:14.364: Initializing the Tumbler XDG cache plugin
tumblerd-DEBUG: 10:33:14.413: Ready to handle requests
tumblerd-DEBUG: 10:33:17.097: Handling request 1
tumblerd-DEBUG: 10:33:17.097: URIs | Mime types:
file:///home/user/Books/folder.svg | image/svg+xml
tumblerd-DEBUG: 10:33:17.097: Starting job 1
tumblerd-DEBUG: 10:33:17.098: Ready signal for job 1
tumblerd-DEBUG: 10:33:17.098: URIs:
file:///home/user/Books/folder.svg
tumblerd-DEBUG: 10:33:17.098: Finishing job 1
Last edited by BleepBloop225 (2023-10-29 08:48:57)
Offline
That's because your source image is an svg and the thumbnail files are png. In the folder-thumbnailer file there is a convert command. You will need to add in the "-background none" option so the conversion creates a transparent png thumbnail.
Change the line that reads:
if [ -z "$cover" ] || ! convert -thumbnail "$1" "$cover" "$3"; then
...to:
if [ -z "$cover" ] || ! convert -background none -thumbnail "$1" "$cover" "$3"; then
Make sure you:
Delete (or move) the current svg file you are using for the folder thumbnail
close thunar via "thunar -q"
kill the tumbler session via "pkill tumblerd"
Make the change to the ~/bin/folder-thumbnailer file (if you haven't already done so)
Restart thunar and move the svg file into place.
I believe the original intent of the thumbnailer was to use png and jpg files, but svg can be supported.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
That is awesome, thank you! However, the image gets visibly blurry after its is applied to a directory. Is there a way to change the quality of the conversion?
Offline
Try adding "-density 400" to the line as well:
if [ -z "$cover" ] || ! convert -background none -density 400 -thumbnail "$1" "$cover" "$3"; then
If that doesn't work, what is the image size of the file that you are working with? The larger the default file the less blurriness you will see.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
It works, but some areas of the image are now miscolored:
When manually converting the .svg file to .png the colors are correct but the image is again blurry:
The images are 64x64. I got the best results by first upscaling the images with another software to 256x256, will probably just stick with that unless there's something else I can try.
Finally, is there a way to assign a different (in my case symbolic) icon to the directory in the sidebar? The green one doesn't quite fit with the others in there.
Offline
It works, but some areas of the image are now miscolored:
You might want to take a closer look at Imagemagick and the convert command. Perhaps there is a better set of parameters that can be used to generate a more accurate conversion.
Finally, is there a way to assign a different (in my case symbolic) icon to the directory in the sidebar? The green one doesn't quite fit with the others in there.
Unfortunately, I don't see how that would be possible using this method. The same icon would be used.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
You might want to take a closer look at Imagemagick and the convert command. Perhaps there is a better set of parameters that can be used to generate a more accurate conversion.
I shall look into that later on, thank you for the tip.
Unfortunately, I don't see how that would be possible using this method. The same icon would be used.
That is indeed unfortunate, but only a minor setback.
You have been a massive help and I can't thank you enough! Hopefully my nitpicking wasn't too much of a chore to deal with. I'll mark this thread as solved for now.
Offline
Pages: 1
[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 599.35 KiB (Peak: 616.2 KiB) ]