4

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

Pabru
  • 255
cra0zy
  • 496

6 Answers6

11

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.

cra0zy
  • 496
4

You need to change the Default application from defaults.list.

Open the defaults.list file in terminal by

sudo -H gedit /usr/share/applications/defaults.list

Search for xml=firefox if your default browser is Firefox and replace by xml=gedit.

That is

text/xml=firefox.desktop

to

text/xml=gedit.desktop

Enjoy!

muru
  • 207,228
1

Try one of these pages in the official guides:

0

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"
0

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;

Mohd Zaid
  • 141
0

My favorite tool for changing Default Applications and/or Open With... options is the good old Ubuntu Tweak here:

https://launchpad.net/ubuntu-tweak

Yes, it hasn't been updated for a long time, but it still works! (Currently on Ubuntu 15.10)

Simply download and install this: https://launchpad.net/ubuntu-tweak/0.8.x/0.8.7/+download/ubuntu-tweak_0.8.7-1~trusty2_all.deb

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

Sadi
  • 11,074