I would like to gain a deeper understanding of mime-types. So far I understand the following thanks to @munzir-taha
It is normal to have different mime-type file associations on different systems, even when those systems are running the same version of the same distro and even if the user didn't customize any mime associations. This is because the associations depend on the packages installed in each system and maybe the order in which they were installed.
I also understand that a user can add or remove mime-type associations with either of these methods:
manually edit
~/.config/mimeapps.list
using GUI tools. In KDE, this could be done in System Settings or via Dolphin (e.g., right-click the file > Properties > File Type Options and associate the file type with your desired app)
However, I wish to dig deeper into this. I'm running Arch Linux and KDE. I created a new user account for testing. It has the following properties:
The package shared-mime-info is installed:
sudo pacman -Qs shared-mime-info
local/shared-mime-info 1.15-2
Freedesktop.org Shared MIME Info
Public keys have the mime-type text/plain:
$ xdg-mime query filetype id_rsa_test.pub
text/plain
The default handler for text/plain is Atom editor:
$ xdg-mime query default text/plain
atom.desktop
There is no mimeapps.list
for this user. The typical file is not present (as shown below) and there are no other mimeapps.list
files in this user account.
$ less ~/.config/mimeapps.list
/home/deleteme/.config/mimeapps.list: No such file or directory
The system appears to have a system-wide association for .pub
files with the mime-type application/vnd.ms-publisher
. This file is present on the system:
/usr/share/mime/application/vnd.ms-publisher.xml
The contents of the above file include a glob pattern for .pub
files:
<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/vnd.ms-publisher">
<!--Created automatically by update-mime-database. DO NOT EDIT!-->
<sub-class-of type="application/x-ole-storage"/>
<glob pattern="*.pub"/>
</mime-type>
Why is the above mime-type not determining the result of this query?
$ xdg-mime query filetype id_rsa_test.pub
text/plain
From what I already know, I would expect that a mimeapps.list local to the user would be responsible for that association, but there is not any such file.
I do not find any other association for .pub
files on this system. As I mentioned, there is no mimeapps.list for this new user account.