Having the same problem, KDE. Looks like this is GIO's fault, but also KDE's fault, but also I don't know what I'm talking about but here's what I've got.
Firefox opens PDFs in Inkscape, which is clearly insane. KDE opens them in Okular. Similarly, Firefox opens directories in Konqueror instead of Dolphin. xdg-mime gets both right:
Looks like xdg-mime detects if I'm running KDE and uses "ktraderclient", whatever KDE plumbing thing that is.
The difference appears to be that KDE respects an "InitialPreference" value within .desktop files -- the highest value wins. I can tell this is a KDE thing because the only files I have with such a setting are built-in KDE 4 apps. Okular is 8, Dolphin is 10. (kfmclient is also 10, so who knows what breaks the tie.) So, naturally, KDE applications will win over everything else unless otherwise specified.
GIO, of course, ignores all this nonsense entirely.
But, dearest CC list, there *is* a light at the end of the tunnel! You see, KDE *does* correctly write out user-preferred applications to ~/.local, but *only if you actually change them*. So if you want the builtin default of Okular to be your PDF reader, you can do something like this:
- Open System Settings > File Associations
- Find application/pdf
- Select Okular and move it down one space (!)
- Click Apply
- Select Okular and move it back to the top
- Click Apply again
If you don't actually make a change, KDE will cleverly assume nothing should be done, despite showing a dialog that clearly says "I'm doing things", progress bar and all.
Anyway, doing this for application/pdf and inode/directory has miraculously brought Firefox's opinion on those filetypes in line with mine, and all is well.
Not a Firefox bug, not really a GIO bug, arguably not even a KDE bug. No one caused the problem, yet the problem remains. Ah, computers. It's perhaps ironic that this was all caused by exactly the thing comment 23 proposes would fix it: priority in .desktop files.
Having the same problem, KDE. Looks like this is GIO's fault, but also KDE's fault, but also I don't know what I'm talking about but here's what I've got.
Firefox opens PDFs in Inkscape, which is clearly insane. KDE opens them in Okular. Similarly, Firefox opens directories in Konqueror instead of Dolphin. xdg-mime gets both right:
$ xdg-mime query default application/pdf on_pdf. desktop
okularApplicati
$ xdg-mime query default inode/directory
dolphin.desktop
But the first things in the mimeinfo.cache list are Firefox's (and GIO's) choices:
application/ pdf=inkscape. desktop; gimp.desktop; kde4-okularAppl ication_ pdf.desktop; kde4-active- documentviewer_ pdf.desktop; =kde4-kfmclient _dir.desktop; kde4-cervisia. desktop; kde4-dolphin. desktop; kde4-filelight. desktop; kde4-gwenview. desktop;
inode/directory
Looks like xdg-mime detects if I'm running KDE and uses "ktraderclient", whatever KDE plumbing thing that is.
The difference appears to be that KDE respects an "InitialPreference" value within .desktop files -- the highest value wins. I can tell this is a KDE thing because the only files I have with such a setting are built-in KDE 4 apps. Okular is 8, Dolphin is 10. (kfmclient is also 10, so who knows what breaks the tie.) So, naturally, KDE applications will win over everything else unless otherwise specified.
GIO, of course, ignores all this nonsense entirely.
But, dearest CC list, there *is* a light at the end of the tunnel! You see, KDE *does* correctly write out user-preferred applications to ~/.local, but *only if you actually change them*. So if you want the builtin default of Okular to be your PDF reader, you can do something like this:
- Open System Settings > File Associations
- Find application/pdf
- Select Okular and move it down one space (!)
- Click Apply
- Select Okular and move it back to the top
- Click Apply again
If you don't actually make a change, KDE will cleverly assume nothing should be done, despite showing a dialog that clearly says "I'm doing things", progress bar and all.
Anyway, doing this for application/pdf and inode/directory has miraculously brought Firefox's opinion on those filetypes in line with mine, and all is well.
Not a Firefox bug, not really a GIO bug, arguably not even a KDE bug. No one caused the problem, yet the problem remains. Ah, computers. It's perhaps ironic that this was all caused by exactly the thing comment 23 proposes would fix it: priority in .desktop files.