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

5
  • Which way have you tried (and didn't work)?
    – Sadi
    Dec 13, 2015 at 15:46
  • 1) Right click properties and 2) setting default application for "application/xml" with terminal.
    – cra0zy
    Dec 13, 2015 at 17:29
  • 1
    You might also try checking the files ~/.local/share/mimeapps.list and ~/.local/share/mimeinfo.cache - if necessary - changing or adding the entry text/xml=gedit.desktop
    – Sadi
    Dec 13, 2015 at 17:35
  • Does not work....
    – cra0zy
    Dec 14, 2015 at 17:26
  • No help, but just wanted to let you know I'm experiencing the same issue. Must be a bug in 15.10. I already had ubuntu tweak installed, but it didn't work either.
    – gnomed
    Feb 17, 2016 at 16:21

6 Answers 6

10
+200

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.

2
  • if you don't have ~/.config/mimeapps.list, look for .local/share/applications/mimeapps.list as Anthony Wong pointed out in the answer below
    – patzm
    Jun 7, 2017 at 16:12
  • For anyone as dumb as me: To find the proper file to edit, you need to go to your home folder, then click View->show hidden files (or Ctrl+H). Then the .config folder will appear.
    – pheidlauf
    Dec 6, 2017 at 18:44
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!

2
  • 4
    I prefer to add the line under the [Default Applications] section in ~/.local/share/applications/mimeapps.list, because this file is per-user. Changes in /usr/share/applications/defaults.list will be overwritten by system update. May 18, 2016 at 5:30
  • 1
    This did not work for me on 16.04 - I HAD to add the line also to my local mimeapps.list
    – HDave
    Sep 22, 2016 at 13:36
1

Try one of these pages in the official guides:

3
  • That will not help... the problem is that default browser entry keeps overwriting the default application for xml files.
    – cra0zy
    May 21, 2016 at 9:57
  • @cra0zy: Maybe you need to change it in the browser too. In Firefox: Edit -> Preferences -> Applications May 21, 2016 at 17:16
  • This answer helped me.
    – Christine
    May 30, 2016 at 20:56
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

1
  • Doesn't allow gedit to be set, that is I can select it, but after the dialog closes the system resets it back to default web browser.
    – cra0zy
    Dec 14, 2015 at 17:27
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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.