I'm failing to add a custom icon to a custom MIME type file. I don't know what I'm doing wrong, I've followed several tutorials in here and on other websites.
First I created a xml file called org.xml
in /usr/share/mime/packages
. My file looks like this :
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/org">
<comment>Emacs Org-mode File</comment>
<comment xml:lang="fr">Fichier Emacs Org-mode</comment>
<glob pattern="*.org"/>
<icon name="org-icon"/>
<alias type="text/org"/>
</mime-type>
</mime-info>
Then I updated the MIME database with the command :
sudo update-mime-database /usr/share/mime
The MIME type association is working and my Org files are detected as text/org
but they still have a default file icon.
So I created a 512×512 custom icon and named it org-icon.png
.
sudo xdg-icon-resource install --context mimetypes --size 512 --mode system org-icon.png org-icon
This succesfully copy the icon to /usr/share/icons/hicolor/512x512/mimetypes
although the icon file seems corrupted and I can't open it using an image viewer. I get the error message : Failed to open input stream for file
.
After that I tried to execute :
sudo gtk-update-icon-cache --ignore-theme-index /usr/share/icons/
But nothing changed it doesn't work. My org files still have the default file icon.
What am I doing wrong ? Can't figure it out.