New `MimeType` fields in .desktop

Bollinger, John C John.Bollinger at STJUDE.ORG
Tue Feb 16 23:04:29 UTC 2021


Hello Jehan and All,

On Tuesday, February 16, 2021 11:57 AM, Jehan Pagès <jehan.marmottard at gmail.com> wrote:

On Tue, Feb 16, 2021 at 5:55 PM Bollinger, John C <John.Bollinger at stjude.org<mailto:John.Bollinger at stjude.org>> wrote:
Hello all,

I think the decision to omit MIME-type priority is about scope, not about concerns regarding specific (mis)uses.  Desktop files can express that an application is _suitable_ for handling files of certain types, but it is not their role to convey system policy, such as which application actually should handle any particular file.

With regard to the GIMP example, then, I do not see a missing feature of the desktop entry, but instead clumsy behavior of the GIMP installer -- probably as used by an automated package-installation script, for I think I recall that a manual installation of the GIMP provides a conventional dialog for selecting the image formats for which it should be the default application.

I am a bit confused about what you are talking about. I am talking about the .desktop file specification, hence I am obviously talking about Linux distribution installation. We don't provide an "installer" or "package-installation script" of any sort for Linux (well we have a Flatpak, but I can ensure you we don't do what you say, because I wrote most of this package manifest; and anyway Flatpak doesn't have this kind of ability, it also only provides desktop files).
It looks to me like you are talking about our Windows installer, which is a completely different topic (yes file association works differently on Windows).

By "the GIMP installer" I am talking about those software components that effect the installation of the GIMP in any particular situation of interest, inclusive of components provided by third-party packagers.  If I have misremembered the feature set of its makefile / manual installation script then my apologies, but that is entirely tangential.

For GNU/Linux systems (and possibly *BSD?), as far as I know, the only thing we provide (relatively to file format association) is the desktop file where we list supported formats, as is the standard on such systems. We don't have an installer and certainly no "automated installation script", neither "dialog for selecting the image formats for which it should be the default application"; so I have no idea what kind of clumsy behavior of ours you mention.

I would find it extremely surprising if unpackaged distributions the GIMP for any platform did not come with any mechanism for performing an installation -- no script, no "install" target in a makefile, nothing.  I know that packaged (RPM / DEB / etc.) distributions of the GIMP have installation components, as it is inherent in these formats.

Or maybe you are talking about some specific packaging scripts by distribution packagers (are they really distribs which do what you say, though?). Then this is exactly the problem I want to solve, packagers cannot know and set up format association rules for every software out there (Debian has more than 50,000 packages; same for Fedora, etc.).

Actually the Desktop or AppData specification got created exactly for this reason: so that distribution don't have to manage themselves the things that the software devs know the best (software title, description, icon, mime type association, etc.).

And only that tiny minority of packages that provide desktop files are relevant to the discussion -- hundreds, not tens of thousands.  And among those, only the ones that include MIME-type associations at all.  I see a lot of packages, and I see far more desktop files than most people do, and I can assure you that very few of the desktop files I see specify MIME associations.

But this, too, is missing the point.  It is not individual packagers' responsibility to know MIME-type associations for all the packages there are, nor even to choose default associations for all the MIME types in the MIME database.  Nor is any of that the responsibility of the maintainers of any particular piece of software.  The responsibility of all those people in this area is to avoid wantonly overriding the local policy of individual systems on which the software is installed.

Simply dropping a desktop file on the filesystem is not wanton in this regard, because doing so does not express any kind of policy.  This is explicit in the provisions of the desktop spec that the proposal at hand seeks to change.  Instead, the XDG mechanism for assigning default MIME-type associations is part of the MIME Applications Specification (https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html).
Association between MIME types and applications<https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html>
The freedesktop.org Shared MIME database provides a single way to store static information about MIME types and rules for determining a type.. The freedesktop.org Desktop Entry specification allows applications to announce which MIME types they support.. This specification solves the remaining issues: which application should open a file by default, how to let the user change the default ...
specifications.freedesktop.org



Moreover, I don't think that splitting the supported MIME types into two tiers would really solve the underlying problem.  It would give hints to installers and management software that they don't get now, but who's to say, for example, that just because XCF is its native format, GIMP ought to take over from some other application as the default handler for that type?

First of all, I am talking about *default* behavior. This is why I even said explicitly in my email:

> Of course, if a format-software association was set manually, it would be best to never let automatic re-association with another software happen.

So if one sets explicitly any other software as default handler of XCF file, no of course, GIMP should not take over.

But if they don't, yes it is perfectly reasonable that after you installed GIMP, the system sets it as being the default handler for XCF. Same as if Photoshop was available on Linux, it should be the default for PSD files. Sorry to say so, but saying it could be better otherwise is just silly.

I agree that where no default application has been explicitly configured, users have no genuine reason to rely on default applications to remain stable.  But that does not imply that some applications should be able to claim to be more equal than others with respect to particular file types.  That some format is native for a given application does not imply that that application should be the one used by default to handle such files.

Obviously for some people specific usage, you might want some different association. Maybe some people want that a double-click on their XCF files end up in another software and that's fine. That's why manual association settings exist. But you cannot pretend this is the default expectation.

Perhaps not for XCF files in particular, though I'm inclined to think that people's expectations vary more than you seem to suppose.  But there is a wide variety of file types that the XDG specifications we're talking about affect, and the case is less clear cut for many of them.  Even for many that the GIMP can handle.

And what if multiple applications have some of the same native types?  (Consider text editors, for example.)  Hints notwithstanding, it's still a policy and system management question that desktop files are not well positioned to address.

I have a hard time understanding what you are trying to prove. You cannot handle all possible cases, this is completely obvious. The computer is not in people's head. So yeah there are no ideal work-for-all solution for fully ambiguous case by nature.
Of course when several software are on the exact same field and support the exact same formats, the system cannot choose for them.

What I am saying is that desktop files are not the right tool for the job.

I am talking about improving the hints based off knowledge of less ambiguous cases (for formats which are exactly in the intent of a given software).

The right approach is to use the existing XDG specification that covers this area: the MIME Applications specification that I already brought up.  One does not have to guess whether there is an explicitly configured default application for a given MIME type -- one can _check_, either on a system level or on a per-user level, as appropriate.  And if one is confident in their justification for setting an application as the default for a given MIME type, then one can do that explicitly.  In fact, inasmuch as the MIME Applications spec provides for a priority list of default applications for each MIME type, it's not even a question of setting a default only if none is already configured.  One can just (for example) add the GIMP to the end of the list of default handlers for XCF, creating a new entry in the appropriate mimeapps.list file if necessary.  That serves even if there is initially a different assigned default.


John





________________________________

Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20210216/e460ed8d/attachment-0001.htm>


More information about the xdg mailing list