How do I set a custom icon for a custom folder under $HOME (Thunar)?

Hi.

I have a folder under $HOME, named Projects for which I’d like to set an icon, much like folders Music, Downloads et al. I’ve inspected $HOME/.config/user-dirs.dirs, which basically (so far) is a copy of /etc/xdg/user-dirs.defaults and it states the following:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.

So I’d like to precisely add my folder there, plus a specific icon. I ran xdg-user-dirs-update --set PROJECTS ~/Projects and it looks like the directory was added to $HOME/.config/user-dirs.dirs:

...
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Musique"
XDG_PICTURES_DIR="$HOME/Images"
XDG_VIDEOS_DIR="$HOME/Vidéos"
XDG_PROJECTS_DIR="$HOME/Projects"

Now what?

I want that folder to use the specific PNG icon file $HOME/.icons/app-dev.png, for instance.

I tried copying that file, converted, as Folder.jpg into $HOME/Projects and restarted Thunar but it didn’t do anything.

I’ve read [SOLVED] User dirs directory icons in Thunar / Desktop / Xfce Forums but I don’t have a single clue as to what I’m supposed to do afterwards… I don’t want to update the icon with what it contains, I only want a static icon instead of the default “folder” icon, so unless I missed something, I fail to see what a script would do there (not to mention what to make it do). For short: I’m lost.

Note I want a custom icon, not an emblem.

Thanks in advance for any hint or suggestion.

Hi @RygelXVI,

Please see:

https://docs.xfce.org/xfce/tumbler/available_plugins#customized_thumbnailer_for_folders

1 Like

Well, I have indeed read that page but fail to understand what to do exactly. That page, from what I understood is to have any folder update their icon according to their contents, right? That’s not what I want. I want a static icon instead, not a dynamic update from the folder’s contents.

I believe you are correct. But I also believe you can modify the Exec= to provide the image somehow.

No, sorry I don’t know how or what. I use KDE, and I specify any custom icons for a directory in a .directory file in the root of the directory.

KDE is awesome!

Yup, it’s straightforward under KDE — I remember once I used it and all I needed was a desktop file with the adequate Icon=blah clause and call it a day… GTK has its own way of making simple things extremely convoluted indeed.

I’ll try on and see what I can get. Won’t spend days on it though. I can live without if I get stuck.

1 Like

Can you right click the folder and go to properties. You may have the folder icon there and it can be clicked and changed.

That icon may not be changed that way, unfortunately. Thunar doesn’t work that way.

With Thunar, the best you can achieve is to add am emblem to the folder in question. This helps to differentiate it from other folder icons.

Thunar (right-click the folder icon) → PropertiesEmblems

You can also set the foreground/background highlight colour, if desired.


You could create a custom desktop entry to a certain directory, and set a custom icon for that; however, this solution may or may not behave as you intended.


As you indicated yourself, when it comes to customising icons similar to KDE, for example;

Perhaps spending some time searching for an icon theme to your liking will bear fruit.


A good choice considering that what you wished for isn’t directly achievable using Thunar. A further two months won’t change that.

Regards.

This topic has run its course.