Linux desktop power user tip
If you want to change the icon of a specific folder/file for some reason, you need to edit the gvfs metadata that is stored in a binary file.
This can be done using built-in gvfs methods like the following:
To get the current, custom icon value
# gvfs-info -a metadata::custom-icon ~/Desktop/foo
(file:///home/yournamehere/Desktop/foo also works)
To set a custom icon
# gvfs-set-attribute ~/Desktop/foo metadata::custom-icon file:///usr/share/icons/Humanity/places/48/folder-music.svg
To reset icon to stock
# gvfs-set-attribute ~/Desktop/foo -t unset metadata::custom-icon
Unlike .desktop files, you cannot refer to a canonical FreeDesktop-type icon. You must use an explicit path to the icon you want to use.
NOTE: in a .desktop file you can ref the icon like ICON=folder-open and you'll get the icon theme's icon for folder-open. This icon will change with the theme.
Show other editable attributes for a file
gvfs-info -w ~/Desktop/foo
Which will return something like this
Settable attributes:
standard::symlink-target (bytestring)
time::access (uint64, Keep with file when moved)
time::access-usec (uint32, Keep with file when moved)
time::modified (uint64, Copy with file, Keep with file when moved)
time::modified-usec (uint32, Copy with file, Keep with file when moved)
unix::gid (uint32, Keep with file when moved)
unix::mode (uint32, Copy with file, Keep with file when moved)
unix::uid (uint32, Keep with file when moved)
Writable attribute namespaces:
metadata (string, Copy with file, Keep with file when moved)
xattr (string, Copy with file, Keep with file when moved)
xattr-sys (string, Keep with file when moved)