AFAIK you can't use file -i
or file --mime-type
to test the functionality of the system-wide MIME database. file
uses magic
and its config by default, so to change the behavior of file
, you would have to change the magic
config.
To check and modify the xdg-open
behavior instead, you should use the XDG-Utilities. For example, you can check the current settings how to handle files with text/plain
MIME type:
~ $ xdg-mime query default text/plain
On my Mint laptop, it returns
gedit.desktop
For text/css
, there's usually no default application set (you can check this using xdg-mime query default text/css
). To change this and set GEdit as default CSS editor, you could use the following command:
~ $ xdg-mime default gedit.desktop text/css
This will insert a line in /home/<Username>/.local/share/applications/mimeapps.list
with text/css=gedit.desktop
. Instead of using xdg-mime, you could modify the mimeapps.list
directly.
Now, xdg-mime query
returns the application i've chosen ...
~ $ xdg-mime query default text/css
gedit.desktop
... and xdg-open /tmp/file.css
will start GEdit and load the CSS fiile.
See also this page on xdg-open
from the Arch Linux Wiki.