On Wednesday, February 17, 2021 3:07 PM, Jehan Pagès 
<[email protected]> wrote:

On Wed, Feb 17, 2021 at 8:26 PM Thomas Kluyver 
<[email protected]<mailto:[email protected]>> wrote:

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<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fxdg%2Fdesktop-file-utils%2F-%2Fissues%2F3&data=04%7C01%7CJohn.Bollinger%40stjude.org%7C0f3e504767e54a34d9cf08d8d388195d%7C22340fa892264871b677d3b3e377af72%7C0%7C1%7C637491928785163963%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=TMPW8VRUDxnv9GJN1q04qUaXUHZmT0EPhTQ5ig5KPrM%3D&reserved=0>),
 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.

Well yes, that's part of the reason why the specifications explicitly say that 
the mime-info database should not be used for choosing default applications.  
But I suppose that in the event that there is no other viable basis for a 
decision, it provides a last-ditch alternative.

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).

Both of those specific approaches (preferring the most recently or least 
recently installed) can be supported by the XDG MIME Applications specification 
and existing software based on that.  I described how it could be done in a 
previous message.  That would, however, require software providers and / or 
packagers to opt in, either by directly modifying the appropriate mimeapps.list 
file as part of their installation process or by invoking some standard agent 
to do so on their behalf.  It would be preferable to use an agent, as that 
would support applying the chosen approach consistently.  Possibly 
desktop-file-install could be given the responsibility.

That's still mediated by central (and per-user) files, however, so I'm 
uncertain whether you would consider it "specified centrally", which you seem 
to be advocating against.  If you disfavor it on that basis then I'm curious 
what kind of alternative you have in mind.


John


________________________________

Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer
_______________________________________________
xdg mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to