Next: Adding support for new tools, Previous: The Key Manager Dialog, Up: Customizing and Extending GPS
You can customize lots of capabilities in GPS using XML files that are loaded by GPS at start up.
For example, you can add items in the menu and tool bars, as well as defining new key bindings, new languages, new tools, ...
XML files are found through three mechanisms, described here in the order in
which they are searched. Files with the .xml extension found through
GPS_CUSTOM_PATH
or the user's directory can override any setup found in
the system directory. Likewise, files found in the user's directory can
override any file found in the GPS_CUSTOM_PATH
directories.
Note that only files with the .xml or .py extensions are considered, other files are ignored.
The INSTALL/share/gps/plug-ins directory, where INSTALL is the name of the GPS installation directory, should contain the xml and python files that will always be loaded whenever GPS is started, by any user on the system.
GPS_CUSTOM_PATH
This environment variable can be set before launching GPS. It should contain a list of directories, separated by semicolons (';') on Windows systems and colons (':') on Unix systems. All the files found in these directories will be searched for customization files.
This is a convenient way to have project-specific customization files. You can for instance create scripts, or icons, that set the appropriate value for the variable and then start GPS. Depending on your project, this allows you to load specific aliases which do not make sense for other projects.
The directory $HOME/.gps/plug-ins on Unix
systems, and %HOME%\.gps\plug-ins on Windows systems, can also contain
customization files which are loaded at startup. This is a convenient way for
users to define their own plug-ins, that they want to load no matter which
project they are working on. Note that you can use the environment variable
GPS_HOME
to override the value of the HOME
variable.
Alternatively, if none of HOME
and GPS_HOME
are defined,
USERPROFILE
is also considered.
XML files must be utf8-encoded by default. In addition, you can specify any
specific encoding through the standard <?xml encoding="..." ?>
declaration, as in the following example:
<?xml version="1.0" encoding="iso-8859-1"?> <submenu> <title>encoded text/title> </submenu>
Any given XML file can contain customization for various aspects of GPS, mixing aliases, new languages or menus,... in a single file. This is a convenient way to distribute your plug-ins to other users.
These files must be valid XML files, i.e. must start with the
<?xml?>
tag, and contain a single root XML node, the name of which is
left to your consideration. The general format is therefore
<?xml version="1.0" ?> <root_node> ... </root_node>
The list of valid XML child nodes that can be specified under <root> is described in later sections. It includes:
<action>
<key>
<submenu>
<pref>
<preference>
<alias>
<language>
<button>
<entry>
<vsearch-pattern>
<tool>
<filter>
<contextual>
<case_exceptions>
<documentation_file>
<doc_path>
<stock>
<project_attribute>
<docgen_backend>
<remote_machine_descriptor>
<remote_path_config>
<remote_connection_config>
<rsync_configuration>