Mozilla should follow shared mime freedesktop specs (determining MIME type of a file and the default app for it)
Categories
(Firefox :: File Handling, enhancement)
Tracking
()
People
(Reporter: tmpfreire, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: helpwanted)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050523 Firefox/1.0.4 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050523 Firefox/1.0.4 Mozilla/Firefox/NSPR/Toolkit (maybe this bug should be re-categorized) should follow the freedesktop standards, to have a better integration within the several desktop environments. IMO this is necessary to have a more integrated Desktop Environment, with a single place to define actions for each file type. There is already a bug filed for icon themes, but nothing is spoken about mime types and default actions. There are two projects at freedesktop developing those standards. one of them is about the shared mime database itself, along with common programs to alter it. The other is about setting default actions for each mimetype, so that file types are correctly handled. http://www.freedesktop.org/wiki/Standards_2fshared_2dmime_2dinfo_2dspec http://www.freedesktop.org/wiki/Standards_2fmime_2dactions_2dspec Reproducible: Always
![]() |
||
Comment 1•20 years ago
|
||
This is not an Extension/Theme Manager bug and I highly doubt it will get any attention as long as it is filed as such. You should probably attempt to find a better product / component for it.
Reporter | ||
Comment 2•20 years ago
|
||
Hmm, it's 'OS Integration', I guess. :)
Comment 3•19 years ago
|
||
For someone who has not read the freedesktop specs it's not clear what exactly you're asking for. The steps to reproduce / expected results / actual results actually need to be specified when filing bugs. After a quick glance through the document at the first link, I think the spec defines the way to get a MIME type for a local file. Based on that I'm moving the bug to Core-File Handling. Is my understanding correct? One issue per bug please, file a different bug on the other spec (although I'm not sure what it is about either).
Reporter | ||
Comment 4•19 years ago
|
||
I think Core-File handling is good. Let me try to explain the issue in a clearer way: I use Linux with KDE as my DE. It has a nice mime handling database, and i have a central management system in which I am able to tell the default actions for each mime type. But when I use Firefox, it does not know anything about it. it has its own mime handling. OK, if I fire gnome apps, the same happens. they have their own mime. But things are changing. just like the clipboard had its interoperability problems solved, other aspects of the Desktop environment need to be reviewed, and components/subprojects shared. mime/file handling is one of them. Freedesktop.org has ongoing projects for unifying the mime databases for gnome/kde, as a spec which should be followed by other OS desktop environments and apps. My two links are for two different projects, but they are together in this single bug, because they are both needed (imo) to solve this single issue. The 'end' (the enhancement this bug proposes) is to 'properly integrate mime/file handling with the rest of the OS/DE'. It means a few things: - a freshly installed firefox will instantly pick up the user file handling preferences on the previously installed Desktop Environment. - changes in the mime preferences will carry on transparently between Fifefox and the DE, without the need of double work. For that to happen we nned also the 'means to an end', which is the mime database spec. Bute there is little use to integrate it if the mime actions are not shared too. I hope you agree with me, that it's actually a single 'problem', which is better solved by following these 2 specs. I just jumped ahead of myself, and instead of just reporting 'I want mime actions to be consistent with my desktop preferences', I looked for the possible solutions, which are the specs which make it possible. Hmm, I think I could have explained my self better the first time around. I think mozilla will have a benefit by participating on the evolution of these specs, and pushing its adoption. And so will the whole FLOSS crowd. Steps to reproduce: 1. set up some mime handling preference on your favorite Desktop Environment 2. Try to open file of said mime type on firefox 3. Firefox does not transparently inherit DE's mime preference. What should happen: Firefox should use preferred application for handling that mime type, as set up by the DE.
Comment 5•19 years ago
|
||
Okay, thanks for explanation. I still think there should be two bugs for two specs, since they can be implemented separately. But I don't particularly care, since I will not be working on this. My understanding is that the code you need is at: http://lxr.mozilla.org/seamonkey/source/uriloader/exthandler/
Updated•19 years ago
|
Comment 6•19 years ago
|
||
fwiw, this code currently asks gnome (via gnome-vfs, iirc) for this stuff. isn't it a bug in gnome-vfs if it doesn't use the freedesktop stuff?
Comment 7•19 years ago
|
||
The code uses a deprecated function: http://developer.gnome.org/doc/API/2.0/gnome-vfs-2.0/gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-mime-type-from-name and they yelled at us because of that: https://bugs.freedesktop.org/show_bug.cgi?id=2928#c21
Comment 9•17 years ago
|
||
i've filled this bug which may be related : Bug 421914 β [GNOME integration] Choosing from Firefox context menu to view a selected image should open the default GNOME image viewer
Comment 10•16 years ago
|
||
I just run into exactly this bug. I am maintaining a local Linux distribution for Swiss schools using KDE. The mime configuration was done according to the freedesktop standard. Because Firefox is much better than Konqueror in many aspects, we added Firefox to the distribution. To our unbelieving amazement Firefox just ignored the mime settings. Maintaining and supporting this setting is a nightmare because now we always have to change the settings in two places and must take great care that both configurations (freedesktop, firefox) stay consistent. Please support the freedesktop standards instead of poorly reinventing the wheel.
Updated•16 years ago
|
Comment 12•15 years ago
|
||
This bug is "NEW" since 2005, and is a real blocker for those who use other DEs than Gnome... I've even written a post on how to hack around it (at http://luisfpg.blogspot.com/2009/04/making-firefox-open-files-honoring-kdes.html), but it's just an ugly hack. IMHO, integration with KDE should be a major goal. Not to mention the KDE open / save dialogs (couldn't find report) and printing (https://bugzilla.mozilla.org/show_bug.cgi?id=228083) integration...
Comment 13•14 years ago
|
||
Any news on this bug, my original bug has been removed as duplicate of this bug, so any progress on this bug would be appreciated.
![]() |
||
Comment 14•14 years ago
|
||
So what GNOME apis would let us do this, exactly? Comment 7 seems to be about a slightly different issue; that's about file-to-type mapping (where the Unix code just needs to implement GetTypeFromFile instead of falling back on getting from extension). This bug is about us not getting the right helper application given a type, if I understand correctly... Or am I misunderstanding?
Comment 15•14 years ago
|
||
Please, someone correct me if I'm wrong, but for me, the point is not which GNOME apis would let you do it, because GNOME is in a lower level of the stack... Think this way: The XDG standard provides functions to make it transparent for applications desktop environment details, like file associations. Then, and each desktop environment provides it's own details. You will never make it work in an standard way by accessing the GNOME api's, because KDE's file associations are not accessible by them. The same applies to XFCE, for example. The real solution would be to use the XDG apis, not the GNOME apis...
![]() |
||
Comment 16•14 years ago
|
||
> The real solution would be to use the XDG apis, not the GNOME apis...
Ok, how does one do that? Can you point me to the documentation for those?
Comment 17•14 years ago
|
||
(In reply to comment #16) > > The real solution would be to use the XDG apis, not the GNOME apis... > > Ok, how does one do that? Can you point me to the documentation for those? xdg@lists.freedesktop.org there is a mailing list for the xdg specs. I could point you to a file how to do this, but I will not be 100% sure it will be the right one. Please ask on the mailing list about the mine-type application mapping and I am sure you will receive a lot of help if you indicate its for thunderbird xdg desktop integration. (BTW. indeed use the XDG specs, never gnome, kde or xfce api's)
![]() |
||
Comment 18•14 years ago
|
||
I someone wants to figure out the APIs to use here, that would be very helpful. I can advise on the relevant parts of the Gecko code, but I don't have the time to go hunting, nor to implement myself...
Comment 19•14 years ago
|
||
I suggest that rather than trying to implement the XDG spec directly, the now standard xdg-open or xdg-mime command should be queried if it exists before falling back to GnomeVFS.
Comment 20•12 years ago
|
||
Since bug 713802, Gecko is using GIO to get the preferred helper app for the MIME type. GIO should be using the freedesktop mime actions spec to get this info. http://www.freedesktop.org/wiki/Specifications/mime-actions-spec Remaining to do here should just be implementing nsExternalHelperAppService::GetTypeFromFile() to use the right APIs to make use of http://freedesktop.org/wiki/Software/shared-mime-info
Updated•8 years ago
|
Comment 21•5 years ago
|
||
So thereβs three options, depending on GIO being supposed to behave according to spec or not:
If GIO wants to be spec-compliant, but isnβt, GIO needs to be fixed.
If GIO is spec-compliant, Firefox uses it wrong and needs to be fixed.
If GIO is intentionally not spec-compliant, Firefox needs to start using something compliant instead.
Who is familiar with the code and can answer which one it is?
![]() |
||
Comment 22•5 years ago
|
||
I don't think there is anyone in particular familiar with both the Firefox-side code and GIO.
Also, it's not clear to me which "spec" is being referenced in comment 21. The freedesktop spec? Web specs? Something else?
Comment 23•5 years ago
|
||
I'm unaware of a web spec for opening files, and this ticket literally has in the title "follow shared mime freedesktop specs", so it seems obvious that is the spec being referred to.
Comment 24•5 years ago
|
||
exactly.
I investigated a bit: In my case I didnβt set any default application for the .docx mime type.
Firefox opended it with Calibreβs ebook Editor, while everything else agrees to use Libreoffice Writer.
I turned to xdg-mime
as a source of truth. It is pretty complex: For my KDE Plasma desktop it internally uses ktraderclient5
which makes it of course act the same as KDE, and gives us Libreoffice Writer for a .docx file:
$ xdg-mime query default application/vnd.openxmlformats-officedocument.wordprocessingml.document
libreoffice-writer.desktop
Firefox starts Calibreβs ebook Editor, which might indicate that its method (GIO?) seems to simply use the first entry in /usr/share/applications/mimeinfo.cache
(that file is for knowing what choices are there, not what to use):
$ grep ml.doc /usr/share/applications/mimeinfo.cache
application/vnd.openxmlformats-officedocument.wordprocessingml.document=calibre-ebook-edit.desktop;calibre-ebook-viewer.desktop;calibre-gui.desktop;libreoffice-writer.desktop;
After manually changing the default to Writer manually in ~/.config/mimeapps.list
, Firefox agrees with xdg-mime and KDE.
I didnβt figure out what the spec says for choosing the default application if none is set. It might be that Firefoxβ/GIOβs behavior is therefore already spec compliant here.
In any case we would get better and more expected results if Firefox used xdg-mime
if available to determine the default.
Comment 25•4 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky] from comment #22)
I don't think there is anyone in particular familiar with both the Firefox-side code and GIO.
Also, it's not clear to me which "spec" is being referenced in comment 21. The freedesktop spec? Web specs? Something else?
https://specifications.freedesktop.org/mime-apps-spec/latest/ar01s02.html
Updated•2 years ago
|
Comment 26•2 years ago
|
||
Maybe I am naive, but would it just suffice to have Firefox run xdg-open $fileName
for all files for which it is set to use the system default application and when xdg-open
is available ?
Description
•