Proposal for a MIME mapping spec

Waldo Bastian bastian at
Thu Jul 8 14:10:11 EEST 2004

Hash: SHA1

On Wed July 7 2004 23:22, Jonathan Blandford wrote:
> More Detailed Description:
> ==========================
> Every application installs a .desktop file as described in the current
> spec.  The 'MimeType' field in that desktop file includes a list of
> every MIME Type that that application can handle.  For example, a PDF
> viewer could have the following entry:
> MimeType: application/pdf
> Applications that can handle multiple MIME Types would list all of the
> ones it can handle in a ';' separated list.  It is expected that for
> some applications this list could get longish.  Additionally, there
> should be no priority for MIME Types in this field, or any form of
> priority in the desktop file.

The syntax should be:

> Caching:
> ========
> To make parsing of all the desktop files less costly, we will provide an
> 'update-desktop-database' program that will regenerate a database file.
> The concept is identical to that of the 'update-mime-database' program
> in that it lets applications avoid reading in (potentially) hundreds of
> files.  It will need to be run after every desktop file is installed.
> One cache file is created for every entry in
> $XDG_DATA_DIRS/applications/, and will create a file called
> $XDG_DATA_DIRS/applications/mimeinfo.cache

The "One cache file is created for every entry" is a bit confusing, I think 
you try to say "In every $XDG_DATA_DIRS/applications/ directory a cache file 
$XDG_DATA_DIRS/applications/mimeinfo.cache is created.", right?

Does this cache file also cover subdirectories such as 
$XDG_DATA_DIRS/applications/kde/ ? I think it should.

> The format of the cache mirrors that of the desktop file, and is just a
> list of mime-types to desktop files.  Here's a quick example of what it
> would look like:
>   application/x-foo=foo.desktop;bar.desktop;
>   application/x-bar=bar.desktop
> Each MIME Type is listed only once per cache file, and the desktop file
> is expected to exist in that particular directory.  That is to say, if
> the cache file is located at /usr/share/applications/mimeinfo.cache,
> bar.desktop refers to the file /usr/share/applications/bar.desktop.

Yes, for the cache that makes sense.

> Preferred Applications:
> =======================
> There is also a preference list to determine preferred application of a
> given MIME Type.  It defines the 'default' application to handle a given
> MIME-Type.  It has the same format as the cache list, except that each
> entry is limited to only one item:
> mime/type:file.desktop
> If a mime type is listed multiple times (either in the same file, or in
> another file further down the search path), the latter mention wins.  If
> a listed file doesn't exist, or is precluded through the 'OnlyShowIn' or
> 'NotShowIn' files, they should be ignored. 

Suggest to change: 
	"If a listed file doesn't exist, or is precluded through the 
         'OnlyShowIn' or 'NotShowIn' files,"
	"If a listed .desktop file doesn't exist, or is precluded through
         the 'OnlyShowIn' or 'NotShowIn' entries in the .desktop file,"

> This means that applications 
> will have to keep a history of the preferred applications that they run
> into, so that if the top desktop file for a given MIME Type isn't
> available, the second one can be tested, etc.

Why not allow multiple entries for a specific MIME Type in this preference 
file? So that you get:


The first entry that isn't precluded through the 'OnlyShowIn' or
'NotShowIn' directives must be used then.

> It is also worth noting who this mechanism is defined for.  It is
> primarily intended for use by distributors/sysadmins to provide a sane
> set of defaults for their users.  Additionally, users themselves can use
> this mechanism to override the user defaults.  We intentionally don't
> provide a way for application authors themselves to list themselves as
> the default for a given type, as we felt that that cannot work.

I think the specification should mention that the .desktop files are to be 
referenced by the "Desktop-File Id" as defined by the menu specification.

- -- 
bastian at  |   KDE Community World Summit 2004  |  bastian at
bastian at  | 21-29 August, Ludwigsburg, Germany |  bastian at
Version: GnuPG v1.2.2 (GNU/Linux)


More information about the xdg mailing list