Create a custom XDG_DIR with custom icon

freedesktopgnomeicons

I'd like to create a custom XDG_CUSTOM_DIR directory in my home directory pointing to $HOME/Custom and assign an icon to it.

I've done:

xdg-user-dirs-update --set CUSTOM ~/Custom

So far so good… ~/.config/user-dirs.dirs has been changed acordingly.

Now: how do I assign an icon to it?

Best Answer

This is not possible as the XDG specification defines specific directory names only for certain roles (example XDG_DOCUMENTS_DIR, XDG_DOWNLOAD_DIR, or XDG_MUSIC_DIR; try man xdg-user-dirs-update to see them all). Various libraries (e.g. glib or GTK+ for GNOME) implement the spec and will perform special operations for only those directories in the spec. So custom directories are not supported.

Off course you could add support to XDG_CUSTOM_DIR in GNOME for your own use. It would require coding skills to patch and compile libraries and applications to support this additional directory. For instance in glib look to https://git.gnome.org/browse/glib/tree/gio/glocalfileinfo.c#n1591 and https://git.gnome.org/browse/glib/tree/glib/gutils.c#n1541 to see how it is handled.

Related Question