Contents->MIME Types
MIME (Multipurpose Internet Mail Extensions) Types were originally used to associate file types sent between Internet E-mail clients, however it has since been extended to other applications including web browsers and file system browsers (such as Endeavour).
Endeavour has a built-in MIME Types engine, that supports objects of different types and uniquenesses to be associated with each other. Each MIME Type has the following properties:
System Object
File Format
Application
Unique Object
application/text-editor
or
image/x-png
. Note that unlike filesystem paths, the
MIME Type's paths do not start with a /
character.
Application
or Unique Object
.
.
character. This value exists only if
the class is set to File Format
.
Application
, File Format
or
Unique Object
.
To define a new MIME Type, go to View->MIME Types...
You should then see the dialog shown below (it may take a while for all the MIME Types to be loaded):
Suppose, for this example, you want to define a MIME
Type for a text file format who's file name extension is
.txt
and the default program to be executed for it
is /usr/lib/endeavour2/bin/tedit
, then first select
an item in the list at where you want to insert
the new MIME Type at and then click on Add...
A new MIME Type will be added and a dialog will appear as shown below:
The Commands list displays a list of commands in which objects that are associated with this MIME Type will be handled. Each command consists of a name that describes the command and a value that will be executed.
The Name is used to describe the command and
will appear in the Open To list (when you go to
File->Open To). The Name may contain spaces,
upper and lower case, and numbers (no punctuations such as
.
,
or ;
). It is matched case
insensitive, for example, view
is the same as
View
.
The Command contains the actual command that is to
be executed. If it starts with an absolute path to an
executable object followed by
any sequence of arguments and tokens
(such as /usr/lib/endeavour2/bin/tedit "%p"
) then that
object and any arguments will be executed. If it contains the
type name of another MIME Type (such as
application/text-editor
) then the default command
for that corresponding application
class MIME Type
will be executed instead, this is called
referencing MIM Types.
The first command in the list is always considered the default, regardless of what its name is. The first command is executed for an object that matches this MIME Type when the user double-clicks on the object or goes to File->Open.
The command who's name is Edit
and is
not the first one in the list (not the default) can be executed
for an object that matches this MIME Type when the user holds
down SHIFT
and double-clicks on the object.
All the commands are available when the user goes to File->Open To, in which a submenu displaying all the command names appears for the object that matches the MIME Type.
To add a command, first make sure that Handle By is set to
Command
and then click on Add.
You will then be prompted for the new command's Name and Command. enter the values as shown below:
The Command may contain any of the following tokens for substitution (click on the Tokens >>> button to see the list of all available tokens on the dialog).
Token | Substituted With |
---|---|
%cwd |
Current working directory |
%display |
Display address |
%first_name |
Name of the first selected object (without the full path) |
%first_name_wo_ext |
Name of the first selected object (without the full path or extension) |
%first_path |
Full path to the first selected object |
%first_path_wo_ext |
Full path to the first selected object without its extension |
%home |
User's home directory |
%name |
Name of the last selected object (without the full path) |
%name_wo_ext |
Name of the last selected object (without the full path or extension) |
%names |
Name(s) of all the selected object(s) (without the full path) |
%path |
Full path to the last selected object |
%path_wo_ext |
Full path to the last selected object without its extension |
%paths |
Full path(s) to all the selected object(s) |
%pid |
Process id |
%pe |
Same as %path_wo_ext |
%p |
Same as %path |
%s |
Same as %path |
To insert a token into the command, set the cursor position on the Command prompt, then select the token that you want to insert and click on Insert.
Double quotes should be placed around the tokens in the
command's value (such as
/usr/lib/endeavour2/bin/tedit "%p"
)
so that the substituted value is not unintentionally separated
into separate arguments if it had spaces in it.
When opening objects by double-click or going to
File->Open
the tokens %names
and %paths
will only describe the one selected object for
each instance of the program being executed to open that object.
This is because each object is matched with a MIME Type
individually and is opened one at a time in this case.
When opening objects by going to
File->Open With...
the tokens
%names
and %paths
will describe all of the
selected objects since only one program is being executed and the
MIME Type is being explicitly specified by the user.
To define an icon for this MIME Type, click
on the corresponding icon in the Icons frame on the right.
You will then be prompted for an icon image file, select
an .xpm
image file that you want to use and
click on Select.
Each MIME Type's icon has the following states:
Endeavour comes with a large set of icons located in:
/usr/share/endeavour2/icons/
Large icons are typically 48 by 48 pixels, medium icons are typically 32 by 32 pixels, and small icons are typically 20 by 20 pixels.
Click on OK when you are done.
So in the future, for this example, if you double-click on an
object who has an extension of .txt
then the
following command will be executed:
/usr/lib/endeavour2/bin/tedit /somewhere/somefile.txt
Where /somewhere/somefile.txt
is the full path to the
actual object.
Valid extensions include .txt .tar.gz .Z *rc Makefile*
.
Prefixes or suffixes (without the .
deliminator) require
a *
character after or before the word (respectivly).
When you define a command for your MIME Type, you can set that
command to either refer to a specific program (as seen in the
above example) or you can refer it to another MIME Type who's
class is set to Application
.
To refer the command of one MIME Type to a
Application
class MIME Type:
First create a new Application
class
MIME Type by clicking on
Add... and set its values to the following:
Application
application/text/editor
/usr/lib/endeavour2/bin/tedit
default
/usr/lib/endeavour2/bin/tedit
For
Application
class MIME Types, only the first
defined command will be used (subsequent commands are ignored).
Click on OK when you are done.
Now go and edit the previous MIME Type that defined
the .txt
file format and change its
command to refer to the type value of the
Application
class MIME Type you just created.
Command values that do not start with an absolute
path imply that the command refers to another MIME Type. For
example, a command value of
application/text-editor
refers to another MIME Type who's type name is
application/text-editor
.
Now the default command for an object who's extension is
.txt
will be refered to the new
Application
class MIME Type who's type value
is set to application/text/editor
. This will allow you to
change your preferred application for a group of MIME Types that all
require just one common application by only changing that one
Application
class MIME Type.
The items that appear in the "Open With" list (the list that
you see when you go to File->Open With...) are MIME Types
who's class is set to Application
.
To add an item to the "Open With" list, follow the steps in
section Defining a MIME Type. Make
sure that you set the MIME Type's class to Application
.
File formats that contain MIME Types which Endeavour can import from are as follows:
*mailcap
)
*media.types
*mime.types
)
mimetypes.ini
)
To import MIME Types:
Note that other MIME Type files may not contain the same amount of
information as the Endeavour Mark II MIME Types format does. So you may
need to edit the imported MIME Types to add more information manually.
In some cases you may want Endeavour Mark II to synchronise its MIME Types with the system's global MIME Types. This way, you only need to update the system's global MIME Types and synchronise Endeavour Mark II to them.
For Debian Linux, Redhat Linux, and Mandrake Linux users, to synchronise Endeavour Mark II's MIME Types with the system's global MIME Types:
/etc/mailcap
) and set the File Type to
Mailcap
, then click on Import, an Options
Dialog will appear.
/etc/mime.types
) and set the File Type to
Media Types
, then click on Import, an
Options Dialog will appear.
MIME Types that already exist in Endeavour Mark II's MIME Types list will be updated, and newer ones will be appended (there will not be any duplicate MIME Types).
You may still need to add additional information (such as icons), since the Mailcap and Media Types files do not contain as much information as the Endeavour Mark II MIME Types do.
You need to repeat the above procedure each time the system's global MIME Types are updated. Information that you added manually, such as icons, will not be cleared or modified when you synchronise.
File formats that contain MIME Types which Endeavour can export to are as follows:
*mailcap
)
*media.types
*mime.types
)
mimetypes.ini
)
To export MIME Types:
To define your own global MIME Types, you must have access
to the global MIME Types file
/usr/share/endeavour2/mimetypes.ini
.
Before you begin, you should back up the existing global MIME Types file (if any).
Defining global MIME Types is similar to the Export process, the steps are as follows.
Endeavour MIME Types files (.ini)
format.
If there were no errors encountered in the above steps and you
backed up your old global MIME Types file, then move the
MIME Types file you just exported to
/usr/share/endeavour2/mimetypes.ini
and then restart
Endeavour.
Endeavour Mark II is Copyright © 1997-2009 WolfPack Entertainment |