[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1005074: plasma-workspace: please provide some default MIME-handling application associations



Package: plasma-workspace
Version: 4:5.23.5-1
Severity: normal
X-Debbugs-Cc: debian-desktop@lists.debian.org

Steps to reproduce:

- Install task-kde-desktop
- Also install gimp, nautilus and libglib2.0-bin
- Have a PDF file (if you're testing in a VM like I was, there's one in
  /usr/share/doc/shared-mime-info)
- Log in to a KDE Plasma session
- Run Dolphin
- Double-click the PDF file in Dolphin
- Close whatever viewer opens
- Run Nautilus
- Double-click the PDF file again, this time in Nautilus
- Close whatever viewer opens
- In a terminal, run: gio mime application/pdf

Expected result:

- From both file managers, the PDF opens in some reasonable KDE viewer,
  like Okular
- `gio mime` says the default is the same KDE viewer

Actual result (in my testing, but might be non-deterministic):

- From Dolphin, the PDF opens in Okular as expected
- From Nautilus, the PDF opens in GIMP
- `gio mime` says the default is gimp.desktop

Workaround: sysadmins can put this in /etc/xdg/kde-mimeapps.list or
/usr/local/share/applications/kde-mimeapps.list:

    [Default Applications]
    application/pdf=okularApplication_pdf.desktop;

or individual users can configure this in ~/.config/kde-mimeapps.list
or ~/.config/mimeapps.list.

This can be resolved in the KDE/Plasma packaging by providing a
/usr/share/applications/kde-mimeapps.list, analogous to the
gnome-mimeapps.list in gnome-session-common.

More details
------------

The way this fits together is:

- The Shared Mime Info spec (implemented by the shared-mime-info package
  in Debian) is used to detect content-types (MIME types) from content
  and extensions.

- The Desktop Entry spec (.desktop files) allows applications to declare
  which content-types they can open. It deliberately does not allow
  application maintainers to mark their application as preferred or a
  default, to avoid an "arms race" where every maintainer says their
  app should be the default.
  https://specifications.freedesktop.org/desktop-entry-spec/latest/

- The MIME apps spec allows distros, desktop environments, sysadmins
  and/or users to choose which application they want to use for each
  content-type, in a way that depends on the desktop environment they
  logged into (but does not depend on the application from which the
  file was opened - Dolphin and Nautilus should behave the same).
  https://specifications.freedesktop.org/mime-apps-spec/latest/

If nobody has expressed a preference, then the fallback behaviour of
the MIME apps spec is to choose an arbitrary one of the apps that can
open the appropriate content-type. For some file types, like PDF, this
leads to unexpected behaviour: there are several apps, including GIMP
and Calibre, that technically *can* open PDFs but are probably not what
you want as a PDF viewer.

Perhaps the Qt/KDE libraries used by Dolphin have some built-in way to
choose a "better" implementation as an extension of the MIME apps spec,
but GLib just follows the spec (and I suspect its arbitrary choice might
just be the first possible handler in alphabetical order).

The intended design seems to be that in a well-integrated desktop
environment, there should usually be an opinionated configuration for
that desktop environment in some central "data" package, installed
to /usr/share/applications/$desktop-mimeapps.list, where $desktop
is the desktop environment's value of $XDG_CURRENT_DESKTOP,
case-folded to lower case. For example, GNOME installs
/usr/share/applications/gnome-mimeapps.list via the gnome-session-common
package, which configures GNOME sessions to prefer GNOME or GNOME-adjacent
applications like eog, evince and firefox.

As with #1004906 in XFCE, I think it would be appropriate for some
"central" KDE/Plasma package (plasma-workspace-data?) to install
/usr/share/applications/kde-mimeapps.list with Okular as the preferred
PDF handler, and perhaps other PDF viewers like qpdfview as a fallback:

    [Default Applications]
    application/pdf=okularApplication_pdf.desktop;qpdfview.desktop;

Similarly, KDE should probably configure viewers for image/photo file
types that would fit well into an KDE environment, to avoid JPEGs
accidentally getting loaded into GIMP, a web browser, or sometimes
even Wine.

Default URL handlers can also be configured in the same way, by configuring
associations for the pseudo-MIME-types x-scheme-handler/http and
x-scheme-handler/https (or any other URL scheme of interest, such as
x-scheme-handler/mailto).

It would be technically possible for the Debian desktop team to set
defaults on a distro-wide basis, by providing
/usr/share/applications/mimeapps.list in the desktop-base package. However,
the choice of defaults is opinionated, so the desktop team would not
necessarily find it straightforward to choose something useful: I expect
it to be difficult to choose defaults that are appropriate for everyone,
because every desktop environment team will probably want their
applications to be the default.

As a result, it's probably better for each desktop environment team to
set their own default apps that integrate well in that environment,
like we do for GNOME as part of the gnome-session packaging.

    smcv


Reply to: