Whole document tree
gnome-mime-infoSynopsis
DescriptionThe routines in the gnome-mime-info allow retrieval of information that has been bound to a given MIME type. There are a number of standard keys used in GNOME to provide default actions and behaviour. To add keys to a MIME type, it is necessary to install a file with the extension .keys in the $gnome/share/mime-info directory or in the ~/.gnome/mime-info directory directory. The former is for system-provided MIME information and the latter is to enable the user to extend the actions as provided by the system. The file $gnome/share/mime-info/gnome.keys is special, as it contains the defaults for gnome, and is read first. In addition, the file ~/.gnome/mime-info/user.keys is read last. This will guarantee that there is a way to set system defaults, and there is a way for the user to override them. There is currently no way to tell anything about the order of the other files in those directories, nor is there any way to override system defaults yet. The .keys files have the following format: Above, the key is the key that is being defined, and value is the value we bind to it. The optional [LANG] represents a language in which this definition is valid. If this part is specified, then the definition will only be valid if LANG matches the setting of the environment variable LANG. The LANG setting is used to provide keys which can be displayed to the user in a localized way. This is an example to bind the key open to all of the MIME types matching image/* and the icon-filename key is bound to the /opt/gimp/share/xcf.png value: Example 2. Sample gimp.keys file
This will make the GIMP the handler for the open action. Files of type xcf would use the filename pointed to in the icon-filename key. f gets interpolated with the file name or the list of file names that matched this MIME type. As you can see from the example above, a .keys file does not need to provide all of the values, it can just provide or override some of the actions. User defined bindings in .keys file will take precedence over system installed files. The following keys are currently used in the GNOME desktop:
Those keys are also queried on the metadata (except in the cases where the lookup would be too expensive). Details |