Differences between revisions 21 and 22
Revision 21 as of 2014-05-04 01:15:47
Size: 3415
Comment: Please ask upstream to register their media types.
Revision 22 as of 2014-12-29 05:03:28
Size: 3662
Comment: mime-support translates FreeDesktop entries to mailcap entries automatically.
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
Declarations of which program handles which media type is done by placing files in {{{/usr/lib/mime/packages/}}}. The format of the file is described in the mailcap(5) manpage, and many examples can be found in {{{/etc/mailcap}}}. On recent systems, dpkg triggers from the {{{mime-support}}} package do all the necessary operations when packages are installed or removed. Media type (MIME) support in Debian is formally described in the [[http://www.debian.org/doc/debian-policy/ch-opersys.html#s-mime|Debian policy]]. Declarations of which program handles which media type is done by placing files in {{{/usr/lib/mime/packages/}}}. The format of the file is described in the mailcap(5) manpage, and many examples can be found in {{{/etc/mailcap}}}. On recent systems, dpkg triggers from the {{{mime-support}}} package do all the necessary operations when packages are installed or removed. Also, information from FreeDesktop menu entry files (see below) is automatically translated to mailcap entries, so it is not necessary to have both. Media type (MIME) support in Debian is formally described in the [[http://www.debian.org/doc/debian-policy/ch-opersys.html#s-mime|Debian policy]].
Line 23: Line 23:
 * create a file named by the package name plus {{{.mime}}} as a suffix , containing information in the mailcap format.
Line 27: Line 25:
 * create a desktop entry named by the program name plus {{{.desktop}}} as a suffix, and document inside what file types the program can accept. Install it in /usr/share/applications.  * either:
   - create a FreeD
esktop entry named by the program name plus {{{.desktop}}} as a suffix, and document inside what file types the program can accept. Install it in {{{/usr/share/applications}}},

   - or, when FreeDesktop entries are not relevant or not expressive enough, create a file named by the package name plus {{{
.mime}}} as a suffix, containing information in the mailcap format.

MIME > Mime Types Support


Support of Media (MIME) types in Debian packages

For the command line

Declarations of which program handles which media type is done by placing files in /usr/lib/mime/packages/. The format of the file is described in the mailcap(5) manpage, and many examples can be found in /etc/mailcap. On recent systems, dpkg triggers from the mime-support package do all the necessary operations when packages are installed or removed. Also, information from FreeDesktop menu entry files (see below) is automatically translated to mailcap entries, so it is not necessary to have both. Media type (MIME) support in Debian is formally described in the Debian policy.

For the file /etc/mime.types, the modification has to be requested by filing a bug on the mime-support package. If the media type is not registered to the IANA, please consider doing so or asking the relevant persons to do so.

Mutt and maybe other applications use the copiousoutput flag to select which command to run for inline display.

For the desktop

The Internet Media Types (IMT) defined as part of the Multipurpose Internet Mail Extensions (MIME) have been reused by freedesktop.org (formerly known as the X Develepment Group, XDG) to associate applications and files in desktop environments.

Association between a file suffix and/or content and file type is done through XML files following the Shared MIME-info Database specification. The Debian package shared-mime-info contains the specification and the program update-mime-database that is used to populate the /usr/share/mime with relevant entries, using the XML file as a source. Again, dpkg triggers will update the database each time a package is installed or removed.

Programs are indirectly associated to file suffixes through the association with a file type. This is done through their .desktop file, with the MimeType entry.

In summary, if you use debhelper:

  • create a XML file named by the package name plus .sharedmimeinfo as a suffix, containing information about a given file type, and its usual suffix.

  • either:
    • - create a FreeDesktop entry named by the program name plus .desktop as a suffix, and document inside what file types the program can accept. Install it in /usr/share/applications,

      - or, when FreeDesktop entries are not relevant or not expressive enough, create a file named by the package name plus .mime as a suffix, containing information in the mailcap format.

Further readings

Information to write this page were collected in during a discussion on the debian-mentors mailing list : http://lists.debian.org/debian-mentors/2007/12/msg00398.html 20071222143401.GB2565@kunpuu.plessy.org