Ubuntu – How to change default application for XML files


I have Ubuntu 15.10

So changing the default application for XML files gets immediately overridden by the default browser and does not keep the changes.

How do you set Gedit as the default application for XML files?

EDIT: In case it's needed, I use GNOME as DE

Best Answer

Oh thank god, I have a solution.

First of all the problem is getting caused by "Default Applications" in "Settings" on "GNOME", in order to save the default application for something like browser it overrides whatever it has as default for a set off applications and creates a double entry under ~/.config/mimeapps.list. This way the default application for that mimetype cannot be changed unless you manually delete the entry for it. To do it:

  • edit the file: ~/.config/mimeapps.list
  • find the [Default Applications]
  • delete application/xml, there is a 2nd entry under [Added Associations] which we want to keep
  • save the file and exit
  • go to any xml file and now the default application can be changed by going Right Click > Properties > Open With

This is probably a bug within GNOME.