New `MimeType` fields in .desktop

Jehan Pagès jehan.marmottard at gmail.com
Wed Feb 17 21:07:41 UTC 2021


Hi!

On Wed, Feb 17, 2021 at 8:26 PM Thomas Kluyver <thomas at kluyver.me.uk> wrote:

> On Wed, 17 Feb 2021, at 18:22, Jehan Pagès wrote:
>
> I do agree it's not so much to start with. Anyway here is the recent
> report: https://gitlab.gnome.org/GNOME/gimp/-/issues/6449
>
>
> Thanks!
>
> This particular user reports that *updating* GIMP causes the file
> association to change. That definitely seems like a bug: I can understand
> that someone might want a newly installed app to take over from the
> previous default, but updating shouldn't affect it.
>
> Reading the EndeavourOS thread about it, I think what's happening is that,
> with no default application set, something takes the first application
> listed in a mimeinfo.cache file as the default. It seems like an obvious
> thing to do. But the man page for update-desktop-database (which generates
> that file) is clear that you shouldn't:
>
> > The  order  of  the  desktop  files  found for a MIME type is not
> significant. Therefore, an external mechanism must be used to determine
> what  is  the  preferred desktop file for a MIME type.
>
> The order of applications in that file is not even currently stable (
> https://gitlab.freedesktop.org/xdg/desktop-file-utils/-/issues/3), so
> each time it's regenerated you could get a different application. But
> simply sorting them would probably put gimp before gwenview, so it wouldn't
> have the result that user wants.
>

There is also something which I am not fond of with the order depending on
a shared database: we must agree on an order which might not be fair. Say 2
applications are on the exact same action fields, i.e. they both work on
the same file formats (for instance JPEG, PNG for image viewers). If the
defaults depend on this shared database, then the same one will
consistently be the default image viewer shadowing (if installed) all the
others. Be it based on character order (then you'd want to just name your
app "aaa") or just whatever the database maintainer prefer for oneself,
it's not right.

On the other hand, when no order is specified centrally, but each software
is able to tell its intent "I'm made to display JPEG, PNG…" without
specifying priority relatively to other software, at least we can go with
fairer algorithm (something not based on an arbitrary choice making a
strict order). Be it "last installed" or "keeping stability to whatever was
here first" (then it will likely be dependent on your desktop choice during
install, and distrib maintainers, at least not the same on all
distributions).

Jehan



> One way to address this is to ship a list of default apps - e.g. Fedora
> associates image/jpeg with Eye of Gnome by default. Fedora appears to set
> this regardless of desktop, but the mime-apps spec (
> https://specifications.freedesktop.org/mime-apps-spec/1.0.1/ ) allows for
> both desktop specific defaults and a sequence of defaults from which it
> will use the first available.
>
> The desktop could (should?) also make a deterministic choice even without
> a default (e.g. sort the desktop files from mimeinfo.cache itself). It
> might be the wrong choice, of course, but a consistent wrong choice and a
> clear way to override it is less frustrating than something that might or
> might not go wrong every time you update it.
>
> Best wishes,
> Thomas
>


-- 
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20210217/3ae5b53e/attachment.htm>


More information about the xdg mailing list