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.

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
_______________________________________________
xdg mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to