automatic mapping of MimeTypes & Categories -> default applications

Stanislav Brabec sbrabec at
Wed Feb 18 09:30:24 PST 2009


In past, we maintained defaults.list for GNOME manually. But the number
of MIME types raises over the time and correct manual mapping of all of
them became a nightmare.

That is why I created a tool to automatically create the mapping based
on a heuristic with defined preferences.

The tool is a pretty ugly bash code /sbin/conf.d/SuSEconfig.glib2, but
it works surprisingly well and makes fix of remaining MIME clashes
trivial. The whole openSUSE GNOME MIME mapping preferences consist from
just 22 lines!

That is why I am planning to rewrite it to C and make it
GNOME-unspecific and then upstream as a Freedesktop utility.

I would like to know, how other distributions handle this problem, and
how this problem is handled by other desktop environments.

Heuristic requires consistent use of Categories GNOME, KDE, Qt, GTK,...

Here is a current config file, which also describes the heuristic. The
syntax of the new tool is a subject of discussion as well.

# If application in this list is installed, it is used as default in GNOME.
# It works in following way:
# 1. Read this file.
# 2. Collect all available desktop files.
# 3. Go through all declared MIME types and search for default application
#    for defaults.list in following order:
# 3.1 Installed application listed here for certain MIME type.
# 3.2 Installed application listed here as preferred default.
# 3.3 Installed application listed here as default.
# 3.4 Installed application with GNOME in Categories.
# 3.5 Installed application with GTK in Categories.
# 3.6 Installed application.
# If there are more applications in the same order, it uses pseudo-randomly
# one of them (last in aplhabetical order).
# Syntax:
# Use xxx as default for all MIME types it declares (see 3.3):
# xxx.desktop
# Use xxx as preferred default for all MIME types it declares (see 3.2):
# !xxx.desktop
# Use xxx as default for mime/type (see 3.1):
# mime/type=xxx.desktop

# Prefer banshee for multimedia where possible

# Prefer contracted commercial applications

# Prefer Install Software over file-roller
# Nice GNOME default applications
# evince supports multi-page tiff, but most people will prefer eog:
# evince supports odp, but we really want OOo

# Firefox

# OpenOffice
# Do not prefer writer for text/plain:

Best Regards / S pozdravem,

Stanislav Brabec
software developer
SUSE LINUX, s. r. o.                          e-mail: sbrabec at
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                          

More information about the xdg mailing list