[Thunar-dev] Custom the meta type X application

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Mon Aug 28 18:37:55 CEST 2006


Marcos Iuato wrote:
> Hi,
> 
> Is it possible to custom the opening of an application when you click on 
>   a file by its extension or meta-type?
> 
> What I need to do is configure by meta-type or extension the aplication 
> that will run when the user click on a file.
> 
> Some others applications have the ability to open application when the 
> user select a file, for exemple, firefox, thunderbird, do I need to 
> configure each application to custom the application that it will open 
> by meta-type, or there is one global configuration?

All modern applications will utilize the Shared Mime Database to lookup
the mime type for a file. There's currently not really a standard that
tells how to associate a mime type with an application, but most
applications today (Thunar, Firefox, Thunderbird, nearly all GNOME
applications) use the MimeType key in the .desktop files of applications.

The tool update-desktop-database generates a mimeinfo.cache file in the
various $XDG_DATA_DIRS/applications directories (your distribution
should be setup to do that automatically when installing new software).
This is a mapping between mime types and desktop-ids of the applications
that claim to handle the mime type.

The defaults.list files have the same format, but are used to store the
users preferred associations between mime types and desktop-ids. This
file is actually edited by Thunar/Nautilus when you used the "Open With"
dialog to change the preferred application.

The freedesktop.org wiki contains several pointers to mailinglist
threads about the discussion of the mime database, and of course the
mime database standard itself.

But note that this does not apply to all applications. For example, all
KDE applications don't use the shared mime database (IIRC that will be
fixed with KDE4 though).

> Thanks,
> Marcos Iuato

HTH,
Benedikt



More information about the Thunar-dev mailing list