4

Earlier my text/xml files were by default opened by firefox I think. Not sure of this because I do not remember exactly. Then I think I installed geany and then my text/xml files were always by default opened by Geany until I installed google-chrome. Now I see they are by default opened by google-chrome.

Until now I did not bother to check what are the default applications associated with a particular filetype.

Now when I check my /usr/share/applications/defaults.list file I see this:

text/html=firefox.desktop;google-chrome.desktop
text/xml=google-chrome.desktop;
application/xhtml_xml=google-chrome.desktop;

My default browser is still set to firefox. The first line above shows both Firefox and Chrome for text/html but for text/xml it is only Chrome.

I think earlier it was Geany for text/xml because that's the reason by default Geany used to open XML files. I'm not sure on this because I've never checked.

Questions

  • I'm wondering how it is set. How a particular application is chosen over another.
  • Also how the semicolon (";") is read in the file.

I'm using Fedora 20 - Mate desktop environment.

Query based on Answer by slm

Based on the Answer by @slm, I see my xml filetypes are associated with Geany. But I see them opening with Chrome instead.

$ xdg-mime query default application/xml
geany.desktop
$ 

As I mentioned above my /usr/share/applications/defaults.list file shows

text/xml=google-chrome.desktop;

So what is the difference and which should override?

6

I usually use the command line tool xdg-mime to determine what applications are associated with a given MIME type.

$ xdg-mime query filetype IMAGE.PNG 
image/png

$ xdg-mime query default image/png
shotwell-viewer.desktop shutter.desktop

You can make this a single command like so:

$ xdg-mime query default $(xdg-mime query filetype IMAGE.PNG)
shotwell-viewer.desktop shutter.desktop

You can change the default using mimeopen like so:

$ mimeopen -d ~/test.pdf

Please choose a default application for files of type application/pdf

    1) E-book Viewer  (calibre-ebook-viewer)
    2) Document Viewer  (evince)
    3) Xournal  (xournal)
    4) GNU Image Manipulation Program  (gimp)
    5) Xpdf PDF Viewer  (xpdf)
    6) Print Preview  (evince-previewer)
    7) Inkscape  (inkscape)
    8) calibre  (calibre-gui)
    9) Other...

use application #2
Opening "/home/saml/Downloads/test.pdf" with Document Viewer  (application/pdf)

NOTE: By the way, the semi-colons are there because there can be multiple associations for a given MIME type. So text/xml could have google-chrome.desktop;firefox.desktop; as it's value would would indicate that there are 2 apps that can handle that particular type.

References

  • I see filetype application/xml is by default should open with geany.desktop. But the xml files are being opened by google-chrome and not geany. – bluefoggy Sep 9 '14 at 13:12
  • Where are you opening these files after making these associations? If you use xdg-open <file> do they correctly open in Geany? – slm Sep 10 '14 at 1:48

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.