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
56 Answers
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.
2You need to change the Default application from defaults.list.
Open the defaults.list file in terminal by
sudo -H gedit /usr/share/applications/defaults.listSearch for xml=firefox if your default browser is Firefox and replace by xml=gedit.
That is
text/xml=firefox.desktopto
text/xml=gedit.desktopEnjoy!
2Try one of these pages in the official guides:
Ubuntu Desktop Guide
GNOME Help
My favorite tool for changing Default Applications and/or Open With... options is the good old Ubuntu Tweak here:
Yes, it hasn't been updated for a long time, but it still works! (Currently on Ubuntu 15.10)
Simply download and install this:
Or add the PPA by tweaking for trusty.
Then you just need to start Ubuntu Tweak and go to Admins and then to File Type Manager, find the file type you need, double click on the entry, and there add/remove apps and/or set the default.
Non-GUI way:
Make sure that files
~/.local/share/applications/defaults.list ~/.local/share/applications/mimeapps.list ~/.local/share/applications/mimeinfo.cache
contain the required entry, e.g. text/xml=gedit.desktop and/or application/xml=gedit.desktop
In GNOME 3.26:
- Right click the file you want to open
- Select "Properties"
- Click on the "Open With" tab
- Select the application
- Click on "Set as default"
Go to file-
.config/mimeapps.list
and Open it. Then under default Applications, look for a line that starts with-
application/xml
Change it to-
application/xml=org.gnome.gedit.desktop;