I'm trying to change the icon for application/x-hwp
files. I've added the icons to the proper places, and checked it with assoGiate (after reading this thread). It shows that my desired icon is associated with the file type. Nevertheless, Nautilus is still showing the old icon. How can I make Nautilus show the correct icon?
Here is a set of instructions that should get you a custom icon for hwp files.
Open a terminal :
Check the MIME type exists :
grep 'hwp' /etc/mime.types
if you get an output resembling
application/x-hwp hwp
skip the next step.Create the MIME type
sudo -H gedit /etc/mime.types
and add the lineapplication/x-hwp hwp
Add the icon (which must be called
application-x-hwp.svg
):(don't forget to replace PathToIcon)
Got the information from here
The main trick is to find out correctly where the actual icons are located.
In order to determine that let's analyze HTML icons. Naming convention for the icons is the same as for the MIME-type, only
/
is replaced with-
and no capital letters are allowed. I.e. MIME-type, say,text/x-changelog
will have the icon namedtext-x-changelog.svg
(orpng
). MIME-type for HTML istext/html
. So its icon will betext-html.*
If we run the commandwe will get several places where these icons are placed:
If we visit each of them with Nautilus we'll see, that
Humanity/
folder contains our current icons,gnome/
- some older ones.HighContrast/
doesn't interest us. So in order to change some icon we should replace the icons located inHumanity/
folder.Also notice that
text-html.svg
icons which are scalable and should have been placed intoscalable
subfolder (that should be logical) are placed into the folders for different sizes instead, in the same way as raster PNG files.After replace of the icons (in all subfolders according to their sizes) with the desired ones icon cache should be updated:
That's it.
There's another way to determine the precedence of icon schemes - to check their
index.theme
files. If we look inside/usr/share/icons/Humanity/index.theme
, we'll see:This means that icons from
gnome
andhicolor
folders will have less precedence than the ones fromHumanity
. This is explained here.Strangely enough, Nautilus doesn't obey these inheritance rules. When I added new MIME-type, I tried placing its icons into
/usr/share/icons/gnome/
,/usr/share/icons/hicolor
,~/.local/share/icons/hicolor
, updating icon database on each step - all in vain. These icons were displayed properly inassogiate
on the first tab, but never in Nautilus. But when I placed them intoHumanity
folder and updated icon database, they appeared at once.N.B. All this applies to the default icon theme. If you use some custom icon theme, you should check where the actual icons are located and add/change icons there instead. Also in newer distributions these inheritance rules may change. Then you should locate the new folder which stores the actual icons (if it is not
Humanity
anymore) as explained previously.I hope you tried logout and login to refresh icon cache.
See also if your icon is available in proper size (the one you're using to display file type in nautilus).
You also might missed running
gtk-update-icon-cache
.Try this tutorial: http://swik.net/Ubuntu/Only+Ubuntu/How+To+Change+File-Type+(mimetype)+Icons+in+Ubuntu/chcrf
Try to manually create icon.theme, here is an example I have from awn:
Manual is here: http://live.gnome.org/GnomeArt/Tutorials/IconThemes