default mime type program is inconsistent between system and the mozilla firefox/thunderbird?

6

3

In kubuntu ,the default programs associated with mime types in mozilla products are completely different from the system-wide setting or user setting. For example, firefox/thunderbird will always use krita to open pdf, but for all other programs such as dolphin will open it correctly via okular

It seems consistent with the /usr/share/applications/mimeinfo.cache:

application/pdf=kde4-krita_pdf.desktop;kde4-okularApplication_pdf.desktop;gimp.desktop

However, the xdg-mime query default application/pdf gives out a correct value: okularApplication_pdf.desktop

And in dolphin->"file type options", it gives a correct priority list: Okular, Gimp, Imagemagick, krita

Is there anyway to make firefox/thunderbird use the correct xdg-mime value instead of the wrong mimeinfo.cache?

Or is there any way I can just copy the correct data into mimeinfo.cache?

Thanks

Wang

Posted 2014-01-28T19:40:59.810

Reputation: 465

I'm not sure, but I think the MIME types being used by Mozilla products may be based on the associations used by Gnome, since Mozilla products use GLib/GTK and not Qt for rendering, so they are using GLib as a base library somewhere under the hood. I've had integration problems similar to this before, and all I can reason is that it's the GNOME side. Maybe install a gnome desktop as a secondary desktop, and see if the file associations that Mozilla suggests are consistent with what Gnome suggests? if so, you could just modify whatever file association storage gnome uses (gsettings)...? – allquixotic – 2014-01-28T19:46:20.577

But I never use GNOME, I am under KDE. This also happens in other pure KDE distro. So I think this is not the GNOME problem. Somehow, the firefox refuses to use the system-wide mime-type query function, but insists to use the mimeinfo.cache. I can manually edit the mimeinfo.cache, but this is very annoying. There are so many entries need to be changed. – Wang – 2014-01-30T04:02:16.437

Answers

8

Finally I figured it out: The Mozilla applications are going to look through list of files for mime-type-app associations in following order:

~/.local/share/applications/mimeapps.list
~/.local/share/applications/mimeinfo.cache
/usr/local/share/applications/mimeapps.list
/usr/local/share/applications/mimeinfo.cache
/usr/share/applications/mimeapps.list
/usr/share/applications/mimeinfo.cache
/usr/share/applications/defaults.list

Actually they should not use mimeinfo.cache at all. Because there is no order in these files. In some distro there will be default mimeapps.list which is nice. But many distros does not have default mimeapps.list. In some distro there is no mimeinfo.cache at all. Thus in these distros it falls back to /usr/share/applications/defaults.list which works fine. But in ubuntu, there are still mimeinfo.caches, which will be automatically generated after each updates. In kubuntu it is even worse, because the associations in defaults.list are specified to gnome apps but not KDE ones.

The good way to solve this is to generate my own mimeapps.list and put it into ~/.local/share/applications/.

Wang

Posted 2014-01-28T19:40:59.810

Reputation: 465

Works like a charm! – chipbuster – 2014-09-15T19:40:00.097

also, it will only show the first one and ignore the rest. my mimeinfo.cache list several applications for PDF, with gimp first. And firefox insists that only gimp can open pdf, anything else i have to hunt for the binary – gcb – 2017-06-01T23:12:31.307

0

Firefox lets you set the helper programs yourself. Go to Preferences => Applications and set accordingly :

enter image description here

Not sure about thunderbird, I don't use it, but there is probably a similar setting in the attachments section.

terdon

Posted 2014-01-28T19:40:59.810

Reputation: 45 216

2Thanks a lot. But this is more like a workaround than solution. However, in my opinion, manually changing the mimeinfo.cache will be a better workaround than yours. The problem is I have to manually change all mimetypes. But with your workaround, I need to do even more work by clicking around. – Wang – 2014-01-30T04:00:12.177

@Wang it looks like firefox is ignoring the global mime settings so I don't see how you have any other choice. You could always run sed -i 's/kde4-krita_pdf/okularApplication_pdf/g' /usr/share/applications/mimeinfo.cache which will change all of them at once – terdon – 2014-01-30T04:16:42.213