Proposal for a MIME mapping spec
bastian at kde.org
Mon Jul 19 17:32:13 EEST 2004
-----BEGIN PGP SIGNED MESSAGE-----
On Thursday 08 July 2004 19:50, Jonathan Blandford wrote:
> Thomas Leonard <tal00r at ecs.soton.ac.uk> writes:
> > > The defaults are first read in
> > > $XDG_DATA_DIRS/applications/defaults.list. It is expected that these
> > > defaults are set solely by the distributor of the system. Then, a
> > > $MIME_PREFS_LIST environment variable is checked for other preferred
> > > applications. This is expected to be set by a sysadmin providing their
> > > own defaults. Additionally, each desktop should prepend its own
> > > defaults to this variable.
> > Why is this config information in $XDG_DATA_DIRS? Surely it should be in
> > $XDG_CONFIG_DIRS? MIME_PREFS_LIST seems unnecessary, since desktops can
> > already add to XDG_CONFIG_DIRS (ROX-Session adds
> > /uri/0install/rox.sourceforge.net/lib/DefaultChoices to the choices
> > search path, for example).
> I would expect there to be a one-to-one mapping between the desktop
> directories and the defaults.list, and thus it's XDG_DATA_DIRS.
> MIME_PREFS_LIST might be unnecessary -- I'm not fully sold on it yet.
> If we think that adding to XDG_DATA_DIRS is sufficient for this, then we
> can just use that.
> > > Then, $XDG_DATA_CONFIG/mime/defaults.list is checked for user-specific
> > > defaults. Finally, it is expected that each desktop will have their
> > > own (optional) user-specific desktop file.
> > XDG_DATA_CONFIG? Do you mean XDG_DATA_DIRS or XDG_CONFIG_DIRS?
> Grr.. XDG_CONFIG_DIRS. I get these environment variables confused.
You write "Finally, it is expected that each desktop will have their own
(optional) user-specific desktop file." isn't that what
$XDG_CONFIG_HOME/mime/defaults.list is supposed to take care of? If you use
an environment specific file you end up with GNOME and KDE applications
having different views of the world.
Assuming that $XDG_CONFIG_HOME/mime/defaults.list should be used (at least
primarily) to record the users preferences, I would like to add the following
note wrt behavior in the face of no defined default:
"When activation of a file of a certain MIME Type is required and no default
application has been specified for this MIME Type in any of the default.list
files the following steps should be taken:
1. A list of all suitable applications that can handle this MIME Type is
constructed. The information from the mimeinfo.cache files can be used for
2. If the list contains only a single application this application will become
the default handler for this MIME Type and is registered as such in
3. If the list contains multiple applications the user should be prompted to
select the application that should be used by default. This choice should
then be registered in $XDG_CONFIG_HOME/mime/defaults.list
4. If no suitable application is found at all, the user may be prompted to
provide an application.
[4a] Such application may be registered in $XDG_CONFIG_HOME/mime/defaults.list
despite the fact that the application's .desktop file does not list the MIME
[4b] Such application may be registered in $XDG_CONFIG_HOME/mime/defaults.list
after it is ensured that the MIME Type is listed in the
applications's .desktop file. In case the original .desktop file is not
editable this may require that an editable copy of the .desktop file is
created under $XDG_DATA_HOME/applications first."
With either variant [4a] or variant [4b].
There is also the scenario that an application is chosen that is restricted to
a particular environment (e.g. due to OnlyShowIn=KDE) To prevent flip-flop
behavior I think that if default.list specifies an application that is for
some reason not suitable (e.g. wrong environment) a new default application
should be selected as described above and the resulting default application
should then be added after, and in addition to, the already listed default
Assume the application gedit which as an application .desktop file known as
gnome-gedit.desktop that contains OnlyShowIn=GNOME
Also assume the application KEdit which as an application .desktop file known
as kde-KEdit.desktop that contains OnlyShowIn=KDE.
In KDE the user is prompted for a default handler for text/plain and selects
KEdit. This choice is registered in $XDG_CONFIG_HOME/mime/defaults.list:
Now the user runs GNOME and opens a text/file, KEdit is not used because of
OnlyShowIn=KDE, the user is prompted for a default handler for text/plain and
selects gedit. This choice is now registered in
$XDG_CONFIG_HOME/mime/defaults.list as follows:
bastian at kde.org | KDE Community World Summit 2004 | bastian at suse.com
bastian at kde.org | 21-29 August, Ludwigsburg, Germany | bastian at suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the xdg