The file /etc/mime.types tells that you can have a file named ~/.mime.types in your user directory and Ubuntu will grab all your defined types from there. However, I couldn't do that. I've read that there was another way to do it, but I would like to know if this way is still possible.
1 Answer
Create a new mime type only for your user
Replace foo
with your file extension, in my example I have used foo
FOUR times
Create a new XML file
nano ~/.local/share/mime/packages/foo.xml
Add the XML code below
<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="text/foo"> <comment>Todos Text file</comment> <glob pattern="*.foo"/> <glob pattern="*.FOO"/> </mime-type> </mime-info>
Update the database
update-mime-database ~/.local/share/mime
-
3That's right, but I guess he says the fact that it should be possible to add a type as /etc/mime.types mentions:
Users can add their own types if they wish by creating a ".mime.types" file in their home directory. Definitions included there will take precedence over those listed here.
Aug 19, 2015 at 20:25 -
This does not help ... this way I can just define type which cannot be associated with any application in
nautilus
... I mean there is not evenOpen With
tab when I right-click and selectProperties
in Nautilus Sep 4, 2019 at 7:41