Bug#1004906: xfce4-session: please provide some default MIME-handling application associations
Package: xfce4-session
Version: 4.16.0-1
Severity: normal
X-Debbugs-Cc: debian-desktop@lists.debian.org
In #1004711, a user of XFCE and GIMP reported that a "wrong" application
was used to open PDF print previews. It seems that GTK was configured to
use something that follows the freedesktop.org MIME apps specification for
its print previews, but XFCE did not express any particular preference for
how to open PDF files.
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.
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 previewer.
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.
In the case of XFCE, it would be appropriate for the defaults supplied
by the desktop environment maintainers to prefer atril as a default PDF
viewer, since that's the one pulled in by task-xfce-desktop. It would
probably also make sense to have other PDF viewers that are in line with
XFCE's overall design, either because they are small (like mupdf) or
because they use GTK (like evince), as lower-priority preferences, perhaps
something like this:
[Default Applications]
application/pdf=atril.desktop;mupdf.desktop;org.gnome.Evince.desktop;
That way, if atril is installed, it will be used; or if mupdf is installed,
it will be used instead; or if evince is installed, that will be used in
preference to less appropriate things like GIMP.
Similarly, XFCE should probably configure viewers for image/photo file
types that would fit well into an XFCE 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 looks like Debian's XFCE packaging *does* install a file listing
default associations, but it has some issues that prevent it from being
an ideal way to solve this problem:
- It's a symbolic link to a conffile in /etc, which means sysadmins are
expected to customize it, but then they will have to resolve conflicts
if the version supplied by the XFCE maintainers changes. The design
of the mime-apps spec is intended to avoid having to merge conffiles:
different preference levels are in different files, and the most
specific preference always "wins" (user > sysadmin > distribution,
and within each of those levels, per-desktop-environment > generic).
- It's using a deprecated location in the search path (see #1004903) which
means that not all implementations of the mime-apps spec will necessarily
read it, and its precedence in the search order is likely to be
inappropriate (because it will be treated as OS defaults rather than
sysadmin configuration).
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.
I'm initially reporting this as an XFCE bug because that's what the
reporter of #1004711 was using, but it seems to be applicable to most of
the other desktop environments (exceptions: GNOME and Cinnamon already
do what I'm recommending here, and MATE uses a symlink in a deprecated
location pointing to a conffile) so I'll try to open similar bugs for
the other desktop environments' main packages at some point.
smcv
Reply to: