Bug 56352 - xdg-mime/xdg-open does not follow mime-actions-spec
Summary: xdg-mime/xdg-open does not follow mime-actions-spec
Status: RESOLVED MOVED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.1.0 rc1
Hardware: Other Linux (All)
: high major
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-24 12:36 UTC by Vladimir
Modified: 2019-02-16 13:35 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2012-10-24 12:36:59 UTC
Freedesktop.org mime-actions-spec (http://freedesktop.org/wiki/Specifications/mime-actions-spec) states that default application for a MIME type is the one that is listed first for a given MIME type in section [Added Associations] of mimeapps.list, e.g.:
------
[Added Associations]
mimetype1=foo1.desktop;foo2.desktop;foo3.desktop;
------
foo1 will will be default for mimetype1

But xdg-open/xdg-mime (via generic function) uses [Default Applications] section
which is not covered in mime-actions-spec and therefore should not even exist in mimeapps.list. 
It also completely ignores standard [Added Associations] section in mimeapps.list.

I edit mimeapps.list:
------
[Added Associations]
application/testapp=leafpad.desktop;
------
then run:
xdg-mime query default application/testapp
It returns nothing, but should return "leafpad.desktop".
Comment 1 Rex Dieter 2012-10-24 13:42:30 UTC
What desktop environment are you using?

xdg-utils leverages DE-specific utilities to query/set this stuff, when they are available, for example, under KDE uses:
ktraderclient


That said, looks like the current code only groks
[Default Applications]

section of mimeapps.lst
Comment 2 Vladimir 2012-10-24 16:46:31 UTC
I use plain openbox, therefore xdg-open goes through open_generic function. No non-standard DE-specific association exceptions should apply.
Comment 3 IgnorantGuru 2012-10-24 21:06:49 UTC
Agreed, this is generating confusion and incompatibility with the spec being one way and xdg-open handling it in another way.
Comment 4 Vladimir 2013-12-12 22:35:13 UTC
Hi! any news on this?
Comment 5 Rex Dieter 2013-12-13 13:56:49 UTC
For me personally, if there was news, I'd post notice about it here.  I haven't had any time to implement this feature in the generic functions.
Comment 6 Daniel Micay 2014-02-19 05:41:42 UTC
The generic functions *do* implement this functionality. The `xdg-mime` utility knows how to deal with mimeapps.list but does it incorrectly. It uses a `[Default Applications]` header not covered in the specification rather than the proper `[Added Associations]` section. The fix is as easy as a quick search and replace of two strings.
Comment 7 Rex Dieter 2014-09-19 18:38:48 UTC
Re-reading
http://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.html
today.

Important bits:

---------------------------
Default Application

Indicating the default application for a given mimetype is done by writing into the group [Default Applications] in the file mimeapps.list.

The [Default Applications] group indicates the preferred application for a given mimetype.
---------------------------

---------------------------
Adding/removing associations

Adding and removing associations between mimetypes and applications is done with the following syntax in the mimeapps.list file:

[Added Associations]
mimetype1=foo1.desktop;foo2.desktop;foo3.desktop
mimetype2=foo4.desktop
[Removed Associations]
mimetype1=foo5.desktop
---------------------------

---------------------------
Application ordering

The suggested algorithm for listing the applications associated to a given mimetype is:

    add any "Default Applications" and then "Added Associations" in the first mimeapps.list

...
---------------------------

So looks like this has been clarified since the bug was filed, and that all of:
[Default Applications]
[Added Associations]
[Removed Associations]
need to be taken into account, highlighting that the xdg-open generic algorithm definitely needs work to comply.
Comment 8 Rex Dieter 2014-09-19 18:50:00 UTC
Given the looming (and hopefully soon) release of xdg-utils-1.1.0 (final), I personally won't have the time or interest in the short-term to implement this properly, and until it is implemented, I'm seriously considering making the existing open_generic code be a last-ditch fallback, and prefer (and strongly recommend) a better implementation be present and used instread, including:
gvfs-open
kde-open

and possibly even others:
gnome-open
mate-open
exo-open
Comment 9 GitLab Migration User 2019-02-16 13:35:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/61.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.