Table of Contents

Name


launcher - a one-stop solution for mapping filenames to handlers using MIME types

Synopsis


launcher [--all ] [--compressed ] [--default ] [--help ] [--nowait ] [--showtypes ] [--type ] [--version ] filenames...

Description


The launcher is intended to be invoked from a commandline or from any sort of program requiring application file handling facilities. It is a layer of indirection between any application and the helper applications required to open a particular file.

General Operation

The launcher can be substituted anywhere a helper app would normally be deployed. Simply construct the commandline necessary to satisfy the behavior expected by the calling application. The Launcher uses two methods to determine the type of files passed in on the commandline and then maps a defined handler (see below) to that file (or group of files). If more than one handler is defined for a given file type, a GUI window will be displayed allowing the user to choose which application to use. The Launcher's primary config file (discussed below) may be edited using either a standard text editor or the GUI configurator which is installed as part of the Launcher package. This GUI can be called from the commandline as "launcherconfig" or may be invoked by clicking the third mouse button in the application selection GUI. This basic mode of operation may be modified by using the options defined below when calling the launcher from a commandline.

Options

--all
Send all same-type files to the same handler invocation if the configuration indicates that the handler can open multiple files. For instance, open all text/plain documents with the same copy of emacs. Note that not all helper apps support multiple files on their commandlines. If the defined app does not support multiple files, a separate instance will be launched for each file, regardless of the state of this flag. This option may be specified in the launcher.map file as a launcher directive. (see below)
--compressed
Peek inside compressed files to detect primary type using the file command's "-z" option. Note that this will return the internal type which will then be mapped to the handlers defined for that type. If your defined handlers do not read compressed data then this won't work very well. One option is to map compressed data reading handlers (like gv) to the compressed types as well as to their primary types. This can be used implicitly with the provided definition in the launcher mapfile called "Peek in compressed..." which will recursively call the launcher with the --compressed option for you.
--default
Surpress user queries and just use the default handler for each type. The default handler is the *first* one defined on any given type. This option may be specified in the launcher.map file as a launcher directive. (see below)
--help
Print out the usage message.
--nowait
Do not wait for each launched application to exit before continuing or exiting. Off by default. Some applications (i.e. Netscape) will delete temporary files when the helper app has exited. If the launcher returns immediately, the file in question may be deleted by the calling application before the handler has read it. This option may be specified in the launcher.map file as a launcher directive. (see below)
--showtypes
Print the name and MIME type of each file to stdout and exit without launching any handlers. This allows the launcher to be used as a generic MIME file typer.
--type mimetype
Force "mimetype" (of the form type/subtype) to the be type for all files specified on the commandline - bypasses all filetype tests. If "mimetype" is unrecognized business will proceed as usual.
--version
Print out the version and primary web address.

Files

/etc/mime.types, /etc/magic.mime, /etc/launcher.map ~/.mime.types, ~/.magic.mime, ~/.launcher.map

The launcher uses up to three files to determine file type and type/handler mappings. Personal user files override global system files. Only one mime.types or magic.mime file, personal or global, need be readable for the launcher to do its work. One launcher.map file is required.

mime.types
The mime.types file is a file extension to MIME type definition file. A copy should be included with the launcher distribution. A copy may also be obtained from the Apache web server distribution. Lines beginning with a "#" are comments. Entries follow the form:
type/subtype    ext [ext] [ext...] 
 e.g. 
 image/jpeg    jpg jpeg jfif 
  
magic.mime
The magic.mime file is a standard "file" command formatted magic numbers file. Instead of outputting the normal human readable, difficult to parse text, it returns MIME types when possible. No attempt will be made to document the format here. A copy should have been included with the launcher distribution. Other copies may be obtained from the Apache web server package or the KDE desktop environment package.
launcher.map
The launcher.map file is the one launcher-specific config file in the package. It is designed to be easily parseable by any utility wishing to have access to the enclosed type/handler mappings. Some of the launcher's commandline options may also be set in this file. They are differentiated from the rest of the data so that other utilities parsing this file may safely ignore them. This mapfile was also designed to overcome some limitations of the common metamail .mailcap file format. Lines beginning with a "#" are comments. All other entries begin with a keyword directive, and all otherwise unrecognized lines will be ignored by the launcher. All entries must appear one-per line with NO breaks within records. In the section below, a "\" is used to escape newlines for readability, but this is NOT NOT NOT a supported option inside the config file. the launcher.map file may be edited with a text editor or the "launcherconfig" GUI which is part of the Launcher distribution.

Launcher options are set as follows:


<directive> <option> <boolean value> 
 e.g. 
 launcher nowait 1 
  
See the options section of this manpage for which options
are supported in the config file. The name used in the config file is identical to the long option name on the commandline, but without the switch prefix "--".

Handler/helper application definitions are set as follows:


<directive> <macroname> <multiplefileflag> <prettyname> \ 
         <handler definition> 
 e.g. 
 handler xv        1 "XV"    xv -8 -owncmap %s 
 handler netscape_rf    0 "Netscape file" netscape3 -remote \ 
         openFile(%s) 
  
The character sequence "%s"
will be replaced with the
filename(s). Similarly, "%d" will be replaced with the parent directory of "%s". Fields with embedded spaces or tabs MUST be quoted. The multiplefileflag field indicates whether or not the application will accept more than one filename on the commandline.

Type/Handler mapping entries are set as follows:


<directive> <mimetype> <handlermacro> 
 e.g. 
 map text/Makefile    emacs 
 map text/Makefile    make 
 map text/plain    emacs jmacs gxedit xedit printtofile make 
  
Multiple mappings may be defined for each type.
The FIRST
type defined for each type is the default. Multiple mappings may be spread across different entries or be strung together on a single line. */* is the default handler for unrecognized types. Defining a handler for */* will prevent the hanlder disambiguation GUI from being displayed in favor of the default handler. Wildcard type handlers such as image/* are not yet implemented.

Author


Ethan Gold <etgold at thaumaturgy dot net>
 http://thaumaturgy.net/~etgold/software/launcher/ 
   
  Launcher version 0.85            May 31, 1999 
  


Table of Contents