On Fri, 10 Jul 2020 at 14:57:24 +0900, Charles Plessy wrote:
> I just remembered it is more complicated: the FreeDesktop menu entries
> do not contain priority values.

As far as I'm aware, this is deliberate, for two reasons:

* The authors and maintainers of individual viewers (evince, calibre,
  okular, etc.) are not well-placed to choose priorities, because
  *obviously* they think theirs is the best, otherwise they wouldn't be
  continuing to develop it. The best you're likely to get from priorities
  is that the maintainers of things that know they *shouldn't* be the
  default, like gimp opening PDFs (which it can, but that's rarely what
  anyone wants), can choose an artificially low priority.

* To get well-integrated desktop environments, the default choice of viewer
  ought to be desktop-specific: if a GNOME user and a KDE user share a
  computer, neither user has expressed any preference about their PDF
  viewer, and they both open a PDF, then the GNOME user ought to get
  evince and the KDE user ought to get okular. (Obviously the user's
  choice, *if they have expressed a choice*, should be prioritized higher
  than this - but we need sensible defaults.)

> The informations used by the Desktop
> Environment systems to sort entries in their menus are somewhere else,
> and I have not found yet...

/usr/share/applications/${desktop}-mimeapps.list, where ${desktop} is
one of the colon-separated values in $XDG_CURRENT_DESKTOP, transformed
into lower case. For example, GNOME sets XDG_CURRENT_DESKTOP=GNOME, and
gnome-session-common provides /usr/share/applications/gnome-mimeapps.list.

I think Ubuntu's Unity used to set XDG_CURRENT_DESKTOP=Unity:GNOME (read
as "Unity, which is similar to/based on GNOME"), which means it would use
/usr/share/applications/unity-mimeapps.list, falling back to the GNOME
list for anything not found there.

Full specification:
https://specifications.freedesktop.org/mime-apps-spec/latest/

    smcv

Reply via email to