gnome-mime - configuration files
The GNOME system uses MIME types to classify content. Each MIME type on the GNOME system has a number of attributes attached to it. Some of these attributes have a special meaning to the GNOME system.
The routines that classify a file by its name, use the contents of all of the files with the extension .mime from the /usr/share/mime-info directory and the ~/.gnome/mime-info to build the database for filename matching. The latter is supported to enable users to provide their mime types to extend the system defaults.
Application that wish to install their own MIME types only need to install a file in this directory.
The file /usr/share/mime-info/gnome.mime is special, as it contains the defaults for gnome, and is read first. In addition, the file ~/.gnome/mime-info/user.mime 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 anyway to override system defaults yet.
The format is the following:
mime-type-name ext[,priority]: ext1 ext2 ext3 ext[,priority]: ext4 regex[,priority]: regex1 regex[,priority]: regex2
where "mime-type-name" is a valid MIME type. For example "text/plain".
For example, for a vCalendar application, this file would be installed:
------ calendar.mime ------- application/v-calendar: ext: vcf -----------------------------
The file /usr/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 anyway to override system defaults yet.
The .keys files have the following format:
mime-type-match: [[LANG]]key=value
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:
image/*: open=gimp %f image/x-xcf: icon-filename=/opt/gimp/share/xcf.png
This will make the GIMP the handler for the open action. Files of type xcf would use the filename pointed 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.
open
icon-filename
view
ascii-view
fm-open
fm-view
fm-ascii-view
Those keys are also queried on the metadata (except in the cases where the lookup would be too expensive).
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |