FILE TYPE DATABASE

A file type database is a plain text file, comprised of one or more records formatted as follows:
# Comment
Descriptive File Type Name
{
   FieldName Value
   FieldName
   {
      Value
      ...
   }
   ...
}

A record starts with a type name string, consisting of alpha-numeric characters and whitespace, followed by a bracketed scope, that is, an opening bracket { on the same or following line, ending with a closing bracket } on a separate line.

Within record's scope, properties and matching patterns are specified as name/value pairs.

Comments may be specified following the # character.

  Record Fields

icon <string>
    Specifies icon name to be displayed for this file type.

mime <string>
    Specifies MIME type. This is not used internally, but is accessible through a context dependent variable %m.

match_name <glob pattern>
    One or more glob patterns to match the file name against.

match_content #<offset> <data>
    One or more data patterns to match file contents against.

action <name>: <command>
    Action to be displayed in the file context menu. Any character in the name may be prefixed with & to specify a mnemonic. Literal & may be specified using the \ escape character.

Multiple values may be specified for match_name, match_content and action fields, - one per line - within a bracketed scope that follows the field name.

If same record name is encountered more than once, the earlier definition is replaced. User defined database files are loaded after system-wide ones, and therefore will override any eponymous records.

See FILES section in this manual, for database file locations.

  Variable Expansion

Unix shell like variable expansion is supported in action command strings.

XFile local and context dependent variables start with the % character, while environment variables start with $. The sh syntax ${...} and respectively %{...} is also supported.

Local variables are defined using X resources in form:
XFile.variable.<name>: <value>

Substitute name with the variable name of choice, and value with the value desired.

  Context Dependent Variables

%n	File name of the selected item.
%p	Path name of the selected item (working directory).
%m	MIME string (if specified in the database).

  Predefined Variables

The default database makes use of several predefined variables listed below. These may be set in user's .Xresources (see Variable Expansion above) to accommodate the environment, without modifying the database.

terminal, textEditor, webBrowser, imageViewer, imageEditor, audioPlayer, videoPlayer.

NOTE:
    The terminal command must treat all arguments passed to it as a list of commands and their respective arguments to be executed (it defaults to xterm -e)