- 2,180
- 2,717
My system is Ubuntu 22.04.4; GNOME Shell v42.9
The application is HomeBank, installed via flatpak. The files have an extension
I found the application logo files under
A Google search brought up this answer from AskUbuntu. I'll list what I did step by step. The OP wanted a custom icon for
Found another answer to a similar question on AskUbuntu again. The OP wanted to add custom icons for MATLAB files and figures. Here's what I did:
Nothing. Absolutely no change.
Came across this question on Unix-Linux SE, decided to give it a go. Ran the following:
[code lang="bash"]
update-mime-database ~/.local/share/mime
sudo update-mime-database /usr/share/mime/
update-icon-caches ~/.local/share/icons
sudo update-icon-caches /usr/share/icons/
sudo update-icon-caches /usr/local/share/icons/
[/code]
And, you probably guessed correctly — still nothing.
I am at a loss at this point.
The application is HomeBank, installed via flatpak. The files have an extension
.xhb
. I want to associate the icon of this application to this file type.I found the application logo files under
/usr/share/icons/hicolor/ZxZ/apps/homebank.png
. The available sizes (Z
) are 16, 22, 24, 32, 48, 256. There was no scalable .svg
icon, but I have built one.A Google search brought up this answer from AskUbuntu. I'll list what I did step by step. The OP wanted a custom icon for
application/x-hwp
files. I want it for application/x-homebank
files.Icons did not change in nautilus.1. Edited/etc/mime-types
to add the line:
Code:application/x-homebank xhb
I confirmed the MIME type by right-clicking on a.xhb
file → Properties in Nautilus.
2. Created anmimetypes/
directory under/usr/share/icons/gnome/scalable/
.
3. Copied the scalable icon as below:
Bash:sudo cp /path/to/icon/application-x-homebank.svg /usr/share/icons/gnome/scalable/mimetypes/
4. Restarted GNOME withAlt
+F2
→r
.
Found another answer to a similar question on AskUbuntu again. The OP wanted to add custom icons for MATLAB files and figures. Here's what I did:
1. Created the following XML file:
[CODE lang="xml" title="~/homebank.xml"]<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-homebank">
<comment>Homebank data file</comment>
<glob pattern="*.xhb"/>
<icon name="application-x-homebank"/>
</mime-type>
</mime-info>[/CODE]
This XML structure is also shown in the docs ofxdg-mime
.
2. Ran the following:
Bash:sudo xdg-mime install --novendor ./homebank.xml
This added the following file in/usr/share/mime/application/x-homebank.xml
:
[CODE lang="xml" title="x-homebank.xml"]<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/x-homebank">
<!--Created automatically by update-mime-database. DO NOT EDIT!-->
<comment>Homebank data file</comment>
<glob pattern="*.xhb"/>
<icon name="application-x-homebank"/>
</mime-type>[/CODE]
That probably shows thatxdg-mime
worked fine.
3. Painstakingly installed the icons, for each of the available sizes listed above, as follows:
Bash:sudo xdg-icon-resource install --novendor --noupdate --context mimetypes --size 48 homebank_48.png application-x-homebank
4. The above step also created symlinks. The directory structure of/usr/local/share/icons/hicolor/
is like this:
[CODE lang="bash" title="/usr/local/share/icons/hicolor tree"]
├── 16x16
│ ├── apps
│ │ └── ...
│ └── mimetypes
│ ├── application-x-homebank.png
│ └── gnome-mime-application-x-homebank.png -> application-x-homebank.png
├── 22x22
│ └── mimetypes
│ ├── application-x-homebank.png
│ └── gnome-mime-application-x-homebank.png -> application-x-homebank.png
├── 24x24
│ ├── apps
│ │ └── ...
│ └── mimetypes
│ ├── application-x-homebank.png
│ └── gnome-mime-application-x-homebank.png -> application-x-homebank.png
├── 256x256
│ ├── apps
│ │ ├── ...
│ └── mimetypes
│ ├── application-x-homebank.png
│ └── gnome-mime-application-x-homebank.png -> application-x-homebank.png
├── 32x32
│ ├── apps
│ │ └── ...
│ └── mimetypes
├── 48x48
│ ├── apps
│ │ └── ...
│ └── mimetypes
│ ├── application-x-homebank.png
│ └── gnome-mime-application-x-homebank.png -> application-x-homebank.png
└── scalable
└── mimetypes
├── application-x-homebank.svg
└── gnome-mime-application-x-homebank.svg -> ./application-x-homebank.svg
[/CODE]
The last directoryscalable/
was added by me manually becausexdg-icon-resource
doesn't support scalable icons by default. I did this with:
Bash:sudo mkdir scalable cd scalable sudo mkdir mimetypes cd mimetypes sudo cp ~/path/to/scalable_icon.svg ./application-x-homebank sudo ln -s ./application-x-homebank.svg ./gnome-mime-application-x-homebank.svg
5. Then ran
Bash:sudo xdg-icon-resource forceupdate
6. Restarted Gnome shell.
Nothing. Absolutely no change.
Came across this question on Unix-Linux SE, decided to give it a go. Ran the following:
[code lang="bash"]
update-mime-database ~/.local/share/mime
sudo update-mime-database /usr/share/mime/
update-icon-caches ~/.local/share/icons
sudo update-icon-caches /usr/share/icons/
sudo update-icon-caches /usr/local/share/icons/
[/code]
And, you probably guessed correctly — still nothing.
I am at a loss at this point.
Last edited: