1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
[[!toc ]]
**Download:** [[Download the MIME database package|Software/shared-mime-info]]
### Overview
Many programs and desktops use the MIME system to represent the types of files. Frequently, it is necessary to work out the correct MIME type for a file. This is generally done by examining the file's name or contents, and looking up the correct MIME type in a database.
For interoperability, it is useful for different programs to use the same database so that different programs agree on the type of a file, and new rules for determining the type apply to all programs.
Here you will find:
* A specification which describes how the new system works.
* A package containing a large number of common MIME types, created by converting the existing KDE and GNOME databases to the new format and merging them together, and software for updating the database.
The system allows the following types of operation:
* A single place for applications to register information about MIME types:
* A **text/html** file should be described as an **HTML Page** in **English**.
* A way for applications to extend the rules for guessing the type of a file:
* Files with names matching ***.html** are **text/html** files.
* Files with **<html>** near the start are **text/html** files.
* The system is extensible, so other specifications can define extra information that can be added to a type:
* This **.desktop** file provides a way to view **text/html** files.
The system does not provide a mechanism for storing user preferences (Bob likes to view text/html files in Mozilla). See the [[MIME actions specification|Specifications/mime-actions-spec]] for that.
### Shared MIME database package
The core database and the **update-mime-database** program for extending it are available from the [[software pages|Software/shared-mime-info]].
If you have added types that should go in the common freedesktop.org base list of types, you should create an enhancement request on [[the MIME bugtracker|https://bugs.freedesktop.org/buglist.cgi?product=shared-mime-info&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED]] with your new XML file.
### Tutorials
Application authors and users who want to extend the database should read the [[Adding to the database tutorial|Specifications/AddingMIMETutor]]. This explains how to add information to the database such as:
* **image/png** can be **edited** using the **Gimp**.
* **image/png** should be **described** in **English** as **"Portable Network Graphics file"**.
* Files whose **names** end in **.png** should have the type **image/png**.
If you want to _read_ the database instead (eg, to work out the MIME type of a file, or find a textual description of a type) then you should use one of the various libraries listed in the **Current implementors** section below, or read the full specification.
### Mailinglist
Discussion of this specification should occur on [[xdg|http://www.freedesktop.org/mailman/listinfo/xdg]].
### Git
The [[Git|Infrastructure/git]] module for this code is [[xdg/shared-mime-info|http://cgit.freedesktop.org/xdg/shared-mime-info/]].
### Current status
The specification is now quite stable and not expected to change in incompatible ways. Integration with icon themes has not been finalised (and is not currently part of the specification).
* ROX has used the system since ROX-Filer 1.3.3 (July 2002).
* GTK has support since version 2.4 (Mar 2004).
* GNOME uses the system since version 2.8 (Sep 2004).
* XFCE uses the system since version 4.2.0 (Jan 2005).
* KDE uses the system since version 4.0 (Jan 2007).
* LXDE has used the system since the initial release of PCManFM (2005).
* EDE uses the system since version 2.0-alpha (Apr 2009, but implemented in May 2007).
Current issues keeping this as 'draft' are:
* The Desktop Base Directory Specification, which this relies on, is still a draft.
### Full specification
* Version 0.11 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.11.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.11/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.11.xml]]
* Version 0.12 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.12.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.12/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.12.xml]]
* Version 0.13 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.13.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.13/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.13.xml]]
* Version 0.14 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.14.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.14/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.14.xml]]
* Version 0.15 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.15.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.15/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.15.xml]]
* Version 0.16 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.16.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.16/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.16.xml]]
* Version 0.17 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.17.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.17/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.17.xml]]
* Version 0.18 - [[html (one page)|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.18.html]] - [[html (multiple pages)|http://standards.freedesktop.org/shared-mime-info-spec/0.18/]] - [[xml|http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.18.xml]]
* [[History and related systems|Specifications/OtherSystems]]
### Current implementors
* [[xdgmime|http://cgit.freedesktop.org/xdg/xdgmime/]]: Reference implementation of the spec. It is dual licensed under the GNU-LGPL and AFL v2.0. It has no dependencies and is written in straight C. It is intended to be included by other libraries that want to support the standard. [[libxdg|https://github.com/vilkov/libxdg/wiki]]: This is a fork of the xdgmime library with additional implementation of [[MIME actions specification|Specifications/mime-actions-spec]], [[Desktop entry specification|Specifications/desktop-entry-spec]], [[Icon theme specification|Specifications/icon-theme-spec]] and [[Icon naming specification|Specifications/icon-naming-spec]]. It is dual licensed under the GNU-LGPL and AFL v2.0. It has no dependencies and is written in straight C. It is intended to be included by other libraries that want to support the standard. [[libsharedmime|http://www.memecode.com/libsharedmime.php]]: Another shared library to query the database. [[KDE|http://www.kde.org/]]: The KDE libraries implement the MIME spec to provide MIME information to all KDE applications. [[GTK+ file selector|http://www.gtk.org/]]: The new file selector in GTK+-2.4 uses the MIME spec to determine icons in it. [[MIME-Editor|http://rox.sourceforge.net/desktop/MIME-Editor]]: Graphical editor with a GTK interface, written in python. [[Perl module File::MimeInfo|http://search.cpan.org/search?query=File%3A%3AMimeInfo&mode=module]](CPAN): Provides a simple Perl interface to query the database. [[PHP library|http://www.liacs.nl/~dvbeelen/MIME.php.txt]]: Provides a simple PHP5 interface to query the database. [[ROX-Lib|http://rox.sourceforge.net/desktop/ROX-Lib]]: Provides a Python module to query the database. [[ROX-Filer|http://rox.sourceforge.net/desktop/ROX-Filer]]: Graphical file manager which uses the database to match filenames and provide textual descriptions for each type. [[gnome-vfs|http://www.gnome.org/]]: The GNOME VFS library provides mime information to all GNOME applications. [[Ruby library|http://code-monkey.de/?mime_info_rb]]: A Ruby module to query the database. [[jmimeinfo|http://hedges.net/archives/2006/11/08/java-shared-mime-info/]]: A Java library to query the database. [[PCManFM|http://pcmanfm.sourceforge.net/]]: Lightweight graphical file manager with tab-browsing which uses the database for all mime-type handling of files. There is a small GPL'd lib called libmimetype included in the source code of PCManFM. [[EDE|http://equinox-project.org]]: EDE library (edelib) provides mime information to all EDE specific applications.
### Links to other specifications
* [[Base directory specification|Specifications/basedir-spec]]: This is used to locate the MIME database. It lets the user override the system settings, and the system settings override the distribution settings. [[MIME actions specification|Specifications/mime-actions-spec]]: This specification describes how applications should be associated with MIME types. This covers both recording that an application is capable of opening files of a particular type, and configuring which application should be the default. [[Desktop entry specification|Specifications/desktop-entry-spec]]: There needs to be a way to indicate which applications can handle a file of a particular type. In the future, this will probably take the form of a link to a .desktop file, as shown in the tutorial above. [[Icon theme specification|Specifications/icon-theme-spec]]: This can be used to locate an icon to represent a given MIME type. The icon name is of the form **media-subtype** (for example: **text-plain**). If no specific icon is found, fallback to **media-x-generic** (eg, **text-x-generic**). See also the [[Icon naming specification|Specifications/icon-naming-spec]]. MIME type icon naming follows the proposal outlined in [[this thread|http://thread.gmane.org/gmane.comp.freedesktop.xdg/6680]]. [[A previous proposal|http://thread.gmane.org/gmane.comp.freedesktop.xdg/669/focus=832]] included a colon character which would have been problematic on Windows and MacOS X file systems.
|