Re: MIME support in Debian.
Am Montag, den 24.12.2007, 01:39 +0900 schrieb Charles Plessy:
> Le Sat, Dec 22, 2007 at 11:01:21PM +0100, Daniel Leidert a écrit :
> > Current GNOME and the upcoming KDE 4 both uses the shared-mime-info
> > database in /usr/share/mime.
> > IMHO you should only try to support the mailcap/metamail and the fd.o
> > shared-mime-info systems.
> many thanks for your answer, I will do what you suggest :
> mailcap/metamail and fd.o support. If I understood correctly, to do so,
> I need to:
> - Have a MimeType entry in the .desktop file.
- Add MIME tyopes to the shared-mime-info database if necessary via
dh_installmime and a .sharedmimeinfo file (or similar).
These two things belong to the fd.o system.
> - Have a debian/packagename.mime file in the source package and call
This is metamail/mailcap.
> I did not find the way to associate a file suffix to the program.
This is done via the MimeType entry in .desktop files. Check
out /usr/share/applications. This file contains the information, which
file/MIME types can be opened/processed by an application.
> Is MIME the way to go ?
MIME just gives you a way to classify content via the Internet Content
Type aka MIME type. So tell the system, that the suffix belongs to a
MIME type (several systems:
libmagic, /usr/share/mime, /usr/share/mime-info/*.mime
+ /etc/gnome-vfs-mime-magic, /usr/share/mimelnk
+ /etc/kde3/magic/*.magic) and associate your program with this MIME
type (also several systems: /usr/share/applications, /usr/share/applnk
(obsolete), /usr/share/mimelnk/*.keys (obsolete), /etc/mailcap).
> The goal would be that mail user agents and
MUAs like evolution use the shared-mime-info database to determine the
MIME type of an attachment. I guess that Kmail uses the KDE3-database of
MIME types (a mixture of .desktop files in /usr/share/mimelnk and an old
version of libmagic, that may be used to determine content pattern for
file types). I don't know, what Mutt uses. AFAIK it does not use
libmagic. But I may be wrong.
This is a question of configuring the web-server. You can use the
mime-support (/etc/mime.types) and/or libmagic (man 5 magic) system
for .g. the apache web server. Both cannot be extended easily during a
package installation. So it's more or less the system administrators
> would use the right mime type with attached/downloaded files,
> and that doubleclicking on local files would make them opened by a
> relevant program.
The MIME type (often used to represent the file type) of local files is
determined depending on the desktop used. KDE 3 has its own system.
XFCE4 and current GNOME AFAIK both use the shared-mime-info database
(KDE 4 will use it too and drop its own solution).
> I have another question: can subcategories starting by x- created
The `x-' in e.g. $primary_type/x-foo means, that this is not an
official/registered MIME type. See RFC 2045 and 2048.
> The program I am working on is Treeview X, a phylogenetic tree
> viewer that can read Clustal W format. It is text based, so David
> Paleino, our collaborator from the Debian-Med packaging team, suggested
If it is unofficial use text/x-clustalw-tree or
application/x-clustalw-tree (depends). To define this MIME type, add an
entry to the shared-mime-info database by writing a file similar to
those found in /usr/share/mime/packages
(dh_installmime/.sharedmimeinfo). The syntax is described in the related
fd.o specification, also shipped with the shared-mime-info packages.
Then associate your program via a .desktop file
in /usr/share/applications. Put the created MIME type in the MimeType
filed in the .desktop file and call dh_desktop in your debian/rules.
The MIME type detection should now work on current GNOME and XFCE
desktops. The program<->MIME type association should work on GNOME, XFCE
and KDE. However, KDE 3 uses its own way to add MIME type definitions to
Say you called your MIME type application/x-clustalw-tree, then install
a file x-clustalw-tree.desktop into /usr/share/mimelnk/applications (the
directories under /usr/share/mimelnk follow the syntax of MIME types).
To support this MIME type via libmagic, add your entries
To associate your program via /etc/mailcap, use dh_installmime/.mime.
> But maybe I can submit a wishlist bug on
> chemical-mime-data to have chemical/clustalw-tree from your namespace ?
Well, chemical is not a registered primary type. It just spread all over
the world after it had been suggested in 1995. However, it has never
been registered and we had some discussions about the future of
chemical/* in the past. It would be better to use one of the official
primary types like text/ or application/ if possible. But I don't know
the content of this file type, so I cannot suggest anything here. Maybe
you can attach an example file to one of your mails?
PS: Even if I shall add it to chemical-mime-data, it would be