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?
I'm trying to change the icon for
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 hwpskip the next step.
Create the MIME type
sudo -H gedit /etc/mime.typesand add the line
Add the icon (which must be called
sudo cp PathToIcon/application-x-hwp.svg /usr/share/icons/gnome/scalable/mimetypes
(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 named
png). MIME-type for HTML is
text/html. So its icon will be
text-html.* If we run the command
find /usr/share/icons/ -type f | grep 'text-html\.'
we will get several places where these icons are placed:
/usr/share/icons/Humanity/mimes/ /usr/share/icons/gnome/NNxNN/mimetypes/ /usr/share/icons/HighContrast/scalable/mimetypes/
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 in
Also notice that
text-html.svg icons which are scalable and should have been placed into
scalable 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:
sudo gtk-update-icon-cache /usr/share/icons/Humanity
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
hicolor folders will have less precedence than the ones from
Humanity. 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
~/.local/share/icons/hicolor, updating icon database on each step - all in vain. These icons were displayed properly in
assogiate on the first tab, but never in Nautilus. But when I placed them into
Humanity 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
Try to manually create icon.theme, here is an example I have from awn:
[Icon Theme] Name=awn-theme Directories=scalable [scalable] Size=48 MaxSize=256 Context=Apps Type=Scalable
Manual is here: http://live.gnome.org/GnomeArt/Tutorials/IconThemes
sudo apt-get install assogiate
follow this good tutorial with nice pictures
If file type is not detected correctly, or showing incorrect file type find your file type identifying characters
EX: rar go to http://filext.com/file-extension/rar
identifier "Hex: 52 61 72 21 1A 07 00 , ASCII: Rar!"
open file in a bless or any hex editor and find the identifier and offset (where your keywords starts)
in our case it the firs bit so offset is "0".
Then go "File types Editor" edit or make a new item, then select edit and under file contents
select "string" from drop down, input "Rar!" and set offset "0".