Bug#942011: xdg-utils should be smarter when selecting from multiple .deskop files for a mime-type

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Oct 9 02:39:11 BST 2019

Package: xdg-utils
Version: 1.1.3-1
Severity: normal
Control: affects -1 gimp dekstop-file-utils xapers
Control: blocks 525077 by -1

different apps install .desktop files that contain a MimeType entry
that includes the same mime-types.

for example:

0 dkg at alice:~$ grep -l '^MimeType=.*application/pdf' /usr/share/applications/*.desktop 
0 dkg at alice:~$ 

Since all of these applications *can* handle a pdf file, they are all
right in doing so (i believe it makes it possible for drag-and-drop to
target an icon derived from the .desktop file based on the mime-type
of the dragged object, for example).

Then, /usr/bin/update-desktop-database (from desktop-file-utils)
gathers all these together and makes a list of them in
/usr/share/applications/mimeinfo.cache.  When it does so, it sorts
them ASCIIbetically (for lack of any better sorting technique):


Then, xdg-open reads this file and picks the first one.

This means that on my system, "xdg-open foo.pdf" will launch

That's clearly the wrong choice.

Presumably, on a desktop system like mine, a sensible priority is
something like:

  * evince or ocular (dedicated, full-fledged pdf viewer apps)
  * pdf-presenter-console or mupdf (specialized custom pdf renderers)
  * libreoffice-draw or inkscape or gimp (apps capable of editing single pages of a pdf)

The current default (having "xdg-open foo.pdf" launch gimp) is just
not credible or user-friendly (as evident in the now decade-old and
resolved https://bugs.debian.org/525077.  It also affects new projects
like xapers, which delegates opening of pdfs to xdg-open.

I don't know where else these priorities should live if not in
xdg-utils.  In the absence of some more sensible distributed priority
system, i think xdg-utils needs to step up and maintain these

This doesn't sound like a fun task, but it's looks like the only way
for xdg-open to do a sensible thing by default, which is presumably
what it is supposed to do.

Thanks for maintaining xdg-utils in debian!


-- Package-specific info:
Desktop environment: XDG_CURRENT_DESKTOP=

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (200, 'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.2.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

xdg-utils depends on no packages.

Versions of packages xdg-utils recommends:
pn  libfile-mimeinfo-perl  <none>
ii  libnet-dbus-perl       1.1.0-6
ii  libx11-protocol-perl   0.56-7
ii  x11-utils              7.7+4
ii  x11-xserver-utils      7.7+8

xdg-utils suggests no packages.

-- no debconf information

More information about the Pkg-freedesktop-maintainers mailing list