## Multi Gnome Terminal User's Guide

Multi Gnome Terminal &mgt-version;
2000
Miguel de Icaza
Michael Zucchi
Alexander Kirillov
2002
Hal Burgiss
Cristiano De Michele

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found here.

Many of the names used by companies to distinguish their products and services are claimed as trademarks. Where those names appear in any GNOME documentation, and those trademarks are made aware to the members of the GNOME Documentation Project, the names have been printed in caps or initial caps.

## Description

Screenshot with Intro to MGT

### Features

&newfeatures;

This document is included with a development version of &term;. It may be out of sync with the current code base as a result. The code base itself may be stable, or may not be, depending on what Cristiano is up to ;-)

]]>

### Notes to Upgraders

This section will address possible configuration and usage issues that might arise from upgrading from an older &term; version. There are always new features. See the `NEWS` file file for a list of what's new with each release, and major bug fixes. And you can read the `ChangeLog`, if you want all the agonizing, gory details.

#### &term; v1.6.1 and v1.6.2

- v1.6.1 and v1.6.2 are bugfix releases. See v1.6.0 below for configuration changes from earlier versions.

#### &term; v1.6.0

- Window and Tab Classes: Previously, all Classes (i.e. configuration profiles), were scoped such that all Tabs for a particular Window shared the same Class configuration preferences. Configuration preferences are now divided such that there are two Class categories, allowing for more flexible configuration schemes. The result is: Tab Classes and Window classes. This means that each Tab can have its own distinct colors, fonts, backgrounds, etc., and that any one Window can conceivably have any number of distinctly different Tab configurations. Some of the immediate ramifications:

  - Any previously defined Classes, will become tclasses (Tab Classes) after upgrading from v1.5.x. This is significantly new behavior. As a result, any start-up Tabs will have lost their Class associations, and will have to be re-defined. Edit Commands also now has options for setting both Window Classes and Tab Classes for start-up Tabs. You can specify both, if need be.

  - The corresponding command line options are now `--tclass` to specify a Tab only Class (new behavior!) And `--wclass` to specify a Window only Class. `--tclass` behavior is notably different now.

  - In previous versions, the Preferences Window contained all important &term; configuration. This has been split into two Windows now, and two corresponding menu selections -- Tab Preferences and Win Preferences. Each selection contains only those preferences that apply to the Class scoping in question, i.e. Tab Preferences contains all attributes, and only those attributes, that can be specified per Tab.

  See the Terminal Configuration Classes Section for details on &term; Classes.

#### &term; v1.5.2

- Default New Term Menu Selections: These are the items at the top of the New Term menu, such as Shell and mc. These can be disabled now. See the Edit Commands Section for details.

- mgt-helper: There is now an -x option that allows running compound shell commands from Edit Commands. Example:

        mgt-helper -x ls -l |less && echo Say good bye, computer. ; echo Good bye ; sleep 3

  Many small configuration and usage improvements as well. There is also a man page, and docmentation now for `mgt-helper`.

- Edit Commands: The Window is now tabbed and re-ogranized, giving more room for those of us with a qazillion commands to deal with. Tip: You can re-order the New Term menu by dragging entries with the mouse and re-locating them within the list.

- New in this documentation: The Keybindings section has been re-written to correct some significant omissions, better highlight key features, and to correct one glaring error. Please read, or re-read, as the case may be.

- Y3K Compliancy: A third generation Toklass class-B Time Runner bot recently took &term; to the year 3,000, and not surprisingly, &term; passed all tests with flying colors. And was subsequently certified by the United Bot Federation (UBF) for use at all Federation operational levels.

#### &term; v1.5.1

- mgt-helper: `mgt-helper` is a shell script that is now bundled with &term; to help improve interaction of &term; with the shell environment. It essentially is a collection of subroutines that add supplemental functionality that would be difficult to accomplish from within &term; alone. For the time being, the best reference for this script, are the comments in the script itself. Some highlights:

  - Did you ever wish you had a separate bash history file (up arrow key from prompt), for specific Tabs? Now you can. Find your custom terminals in Edit Commands, and change the command definition to: `mgt-helper -h <some_id>`, where some_id is some unique string of your chosing. Save and apply changes. This will start a bash shell now with a custom bash history file.

  - You can now use &term; with GNOME URL handlers. This means you can configure GNOME to launch a text based app in its own Tab (or split Tab) for http, ftp, mailto, and file type URLs. So, for instance, if you CTRL-MiddleMouse click on a highlighted HTTP URL in the terminal window, you can launch a text browser that will launch in its own Tab. You will need to set this up in GNOME under Document Handlers. Or, edit your `~/.gnome/Gnome` file. See `mgt-helper --usage` for syntax, and the file itself for further configuration. Other applications will still use GUI defaults (set your preferred GUI defaults in `~/.mgt-helper.rc`). Note: This only works on Linux!

  Note: this script is a work in progress, and is not well tested. The various options are independent of each other, and should be invoked individually.

- Keybindings: There are several new Actions available for Keybindings: New Terminal Menu, Right Click Menu (i.e. the pop-up control menu), Selection mode off (shortcut is pop-up modifier key + MiddleMouse), and Terminal Help (User Guide).

- GNOME Sessions: You can now save your &term; layout (Windows, Tabs, paths, etc), when exiting GNOME, if GNOME is configured to save the current configuration.

#### &term; v1.5.0

- Keybindings: There are a number of new Actions available for use with Keybindings to reflect the new features, such as splitting. These are available from the dropdown list at the top of the Window. But these will not be reflected in the currently defined list of Keybindings for anyone upgrading from 1.4.x, and consequently unavailable for immediate use. In fact, any old keybindings that have been superceded may not work as expected. The solution is to delete the outdated keybindings, and replace them with one of the new ones.

- Command Line Options: There are many new command line options for creating new Tabs, Windows, splits, etc. See the Command Line Options Section for more on this (new ones are near the end of the list).

- New Term Menu (formerly the New Tab menu): Each selection from the New Term menu, will open a sub-menu so as to easily incorporate the splitting feaures. But, this requires a little more mouse movement to open new Tabs.

  If this is inconvenient, consider that anything you do repetitively can be accomplished by other means. And often with less effort. For instance, with Keybindings, any action, such as opening a new Tab, is potentially one key stroke away. Also, bash aliases and the new command line options, could conceivably do the same with a one letter alias. See the Command Examples Section in Appendix A. Also, you can easily define various custom Classes to reflect various working habits so that starting &term;, puts you into exactly the configuration you want for that particular occasion. Any of these methods are arguably easier than the two mouse clicks required for the old menu system (one click to open menu, one to select option).

  The menus are primarily for inexperienced users that have not yet had time to learn the more advanced features. Or, for features that one does not use often.

- Launch URLs: The shortcut for direct launching of URLs (i.e. to bypass the Pop-up menu), is now CTRL-MiddleMouse.

## Usage Overview

### Shells

&term; starts a shell environment (command line interpreter). UNIX shells can significantly extend the capabilities of the usual command line prompt. For example, the bash shell (which is the default shell for most Linux distributions) provides command completion (try entering beginning of a command or file name and press Tab key), a history buffer (you can recall previously entered commands by pressing Up arrow key), and much more. For complete documentation, see the manual pages for the appropriate shells.

&term; further extends the traditional command line interface by allowing potentially many shells to co-exist within the same Window simultaneously.

### Multiple Terminals

The most prominent innovation of &term; is the ability to run multiple terminals within the same X Window. Each terminal constitutes a fully functional shell environment and is represented in the GUI by a Tab.

The terminal window can also be split horizontally and vertically, can be moved from one &term; Window to another, and can be bonded to other terminal windows.

Navigation between opened terminals is easily done either via the Tabs, or keyboard shortcuts, which are configurable.

Tabs can be initialized in various ways, and saved such that new &term; Windows are opened with a user specified configuration, or with the previous state saved, or a combination. See the Tabs Section for details.

### Commands

&term; Commands are shell commands to initialize new terminals. These can be something simple to just start a new interactive shell. Or can do more interesting things, such as change to a specified directory on start up, or `ssh` to a remote host and start a shell there. Or whatever else the imagination may allow ;-)

&term; commands are configured from the Edit Commands selection of the Settings menu, and are then easily invoked from the the New Term menu. Or via keyboard shortcuts (see Keybindings Section). See the Edit Commands Section.

### Key Bindings

Keyboard shortcuts are easily configured for various &term; functions, any user defined Commands, and various other user preferences and usages. These are configured from the Keybindings selection of the Settings menu. See the Keybindings Section.

### GUI Controls

&term; provides various GUI components for navigation, configuration, and control over &term;'s behavior. In addition to the Menus and Scrollbar from &oldterm;, &term; adds a Toolbar and a Buttonbar. And of course, the Tabs. See the User Interface section for an explanation of each.

### Classes

&term; Classes are saved configuration profiles for such things as fonts, colors, backgrounds, Tabs, etc. There are two Class categories: Tab Classes and Window Classes. There can conceivably be many Class profiles created for user preferences, which can be invoked as needed. These can be either invoked at program start-up, or changed dynamically from the Menu.

### Launch URLs

&term; improves &oldterm;'s recognition of URL-like strings on the screen. If clicked with CTRL-MiddleMouse, &term; will try to open the appropriate application: a web browser, mail client, or file manager (or if no on-screen match, this will reset X selection mode). See the Launching URLs Section for more on this feature, which is greatly enhanced, and can conceivably be customized to a high degree.

### Command Line Options

&term; includes a number of useful command line options for creating new Windows, new Tabs, and split Windows. Tabs can even be added to the current Window dynamically. See the Command Line Options Section.

### Emulation

&term; is designed to emulate the xterm program provided by the X Consortium and provides improved emulation support over &oldterm;. xterm, in turn, is an almost-complete emulation of the DEC VT102 terminal.

&term; supports the same extensions to the VT102 that the xterm program provides, through special escape sequences. Recent changes to xterm have been been incorporated into &term;. This includes emulation of the newer DEC VT220 escape sequences and also, full support for VT52. &term; is fully compliant with `vttest`, a program for testing terminal emulator support.

In simpler terms, this means that &term; understands all the commands (escape sequences) used by VT52/VT102/VT220/xterm terminals for things like positioning of the cursor on screen. Therefore, you can run in &term; any application that is designed to work inside VT52/VT102/VT220/xterm terminals and all the controls (such as arrows, PageUp/PageDown keys, Tab key, etc) should work as expected.

## User Interface Overview

&term; provides a number of GUI controls for manipulating various aspects of &term;'s behavior. The GUI controls may be hidden, and most are relocatable.

### Tabs

Each terminal Window has a Tab associated with it. By default, these are located immediately above the terminal Window, though can be re-positioned (see the Tabs Tab Section.). The active Tab is raised, or otherwise emphasized (depending on theme). The Tab identifies that particular terminal and shell (or terminal/shell combinations if the Window is split).

The Tab also allows easy navigation by just left clicking with the mouse. Clicking with the RightMouse button on any Tab will pop-up a small menu of all opened Tabs for that Window. Navigation is also possible with keyboard shortcuts. To move sequentially: the shortcut is SHIFT plus the right or left arrow key. Or directly: CTRL plus the ordinal number of the desired Tab, example: `CTRL-2`. Both methods are configurable with the Key Bindings dialog.

Each Tab has a label that can be customized by middle clicking the Tab, and entering a name in the dialog-box. This can also be done from the Toolbar or the Buttonbar. (The Titled Tabs feature should be disabled for manually renaming labels to work consistently. See the Preferences Configuration Section.)

Inactive terminals (whether split screen or not) notify that their buffer is in the process of changing, or has changed, via colors of the Tab labels. By default, `red` means the buffer content is in the process of changing; and `blue` means a change has taken place, and the buffer is paused. Tab label colors are definable from the Colors Tab of Win Preferences Configuration. The exception is if the terminal is in View mode, or is bonded with other terminals, but is not visible, then the label will not change color (see the File Menu Section. for more on bonded and view terminals).

New terminals can be initiated with selections from the New Term menu. This menu is also available from the Buttonbar, Menubar, or the application control pop-up menu that is activated by CTRL-LeftMouse (see the Pop-up Menu Section.).

The New Term menu has six selections that are enabled by default: Shell, a regular bash shell is started; Root, a root shell is started with `su`; mc, or Midnight Commander, a console file manager application; Split, the current terminal is split using another open terminal; View, a new terminal is created in view mode; New tab with..., a new Tab is created using a split terminal from the current Window, or another Tab or split terminal from another &term; Window. You may add your own customizations to this menu through the Edit Command menu selection of the Settings menu.

Selecting any item from the New Term menu will open a small sub-menu with various options on how and where to open the new terminal. It may be opened as a new Tab in the existing Window, or opened within the existing Window, but with the Window split either horizontally or vertically, or can be opened in a new &term; Window. See the New Term Section for details.

Saving a preferred Tab configuration can be done several ways. Perhaps the easiest way is when logging out of a gnome-session, and then if the current configuration is set to be saved automatically, or if the checkbox to save is checked, then all &term; Tabs for all opened &term; Windows will be restored on the next session start-up.

Also, see the Tabs Tab Section for autosaving the Tab configuration. And then also, the Edit Commands Section for defining custom start-up Tabs on a per Class basis.

### Scrollbar

&term; provides a Scrollbar so that the user can scroll back and see previous commands and output in the terminal buffer history with the mouse. This is especially convenient when a command output does not fit in the viewable screen area. By default, the scrollbar is placed on the right side of the terminal Window. You can change its location or remove the scrollbar altogether using the Preferences Configuration dialog. You can also use the keyboard for scrolling: SHIFT-PageUp scrolls up, and SHIFT-PageDown scrolls down.

### Toolbar

The Toolbar is used to manipulate and initialize Tabs. Like most other GUI components, it may be hidden, or re-located. To move, just grab the handle on the left edge. To hide, see the File menu on the Menubar, or the Pop-up control menu. Also, see the Preferences Configuration Section..

The Toolbar provides the following functions:

- Use the arrow buttons, to re-position the current Tab to the right or to the left.

- Open new Tabs with the three built-in Commands of New Shell, Root Shell, and mc. (See the section called Menubar - New Term.)

- Close and remove the current Tab.

- Change the current Tab's title.

Screenshot Showing GUI Features

From top to bottom: Menubar, Toolbar, Tabs, terminal window, Buttonbar. The Scrollbar is on the left in this shot.

### Buttonbar

The Buttonbar is also used to manipulate and initialize Tabs. Like other GUI components, it may be hidden (but not moved). To hide, see the File menu on the Menubar, or the Pop-up control menu. Also, see the Tabs Tab Section..

The Buttonbar provides the following functions:

- Open new Tabs with the special Commands as listed in the New Term menu. This menu includes the default built-in Commands, as well as any user-defined commands. See the New Term Section. for more explanation.

- Use the Tab Left and Tab Right buttons, to re-position the current Tab to the right or to the left.

- The Remove button removes (closes) the current Tab.

- Change the current Tab's Title.

### Menus

There are three main menus available: the Menubar located at the top of the terminal Window, a Pop-up control menu available by pressing the RightMouse button while holding the CTRL key while on the terminal Window, and the New Term menu which can be accessed with the LeftMouse button while holding the CTRL key (this is a shortcut to the Menubar menu of the same name).

The Menubar is detachable by grabbing the handle (on left edge) with the mouse, and dragging to the bottom of the Window, or can be left free-floating on the Desktop.

#### Menubar - File menu

New Window

  Create a new &term; Window, complete with start-up Tabs and any saved terminals. This is an efficient way to create new &term; Windows, as this uses less system resources than starting a separate copy of &term;. (For advanced users: the new terminal Window created in this way is owned by the same process, with the same PID as the original terminal. Each terminal starts its own sub-shell processes, however.)

Remove Term

  Deletes the current active terminal and associated shell. A prompt is given first to verify the intent. If this terminal is the only opened terminal in that Window, then the Window exits too.

Change Title

  Opens a dialog-box for changing the current Tab label.

Save Terminals

  Save the current Tab arrangement. This will be used on the next start up of &term;, if the Reopen tabs option is enabled in the Tabs section of the Preferences dialog-box. See the Tabs Tab Section.

All bonded

  This will bond all terminals. This means that whatever commands are run in one bonded terminal, are replicated in all the others that are bonded. Note: this is not appropriate for all commands, such as editing a file, or compiling, for instance, since you will have multiple edit and compile sessions running concurrently. Use with discretion! There may also be security implications here ... for instance, typing a password with appear on all bonded terminals. Use with caution!

All unbonded

  Remove bonding (see above).

Show menubar

  Hides the main Menubar on the terminal if unchecked, creating a neater, smaller terminal. The Menubar can be restored using the pop-up menu.

Show toolbar

  Hides the Toolbar if unchecked. The Toolbar can be retrieved using the pop-up menu or the main Menubar.

Show buttonbar

  Hides the Buttonbar if unchecked. The Buttonbar can be retrieved using the pop-up menu or the main Menubar.

Close Window

  Closes the Window ;-) If there are multiple Windows of the same process (i.e. opened with New Window), only the current Window is closed.

#### Menubar - New Term menu

Actually, this same menu is accessible also by clicking with CTRL-LeftMouse on the terminal Window, and from the Buttonbar. This is a tear off menu, and can be positioned on the desktop, independently of the main Window (except the CTRL-LeftMouse Pop-up menu).

This menu is used to manually start the shells and custom Commands of &term;, thus initializing new Tabs and terminals. Most entries when selected will open a sub-menu with four entries to determine how and where the new terminal will be opened (see below).

There are six built-in selections that are enabled by default:

Shell

  Opens a new terminal with a normal, interactive bash shell.

Root

  Opens a new terminal with a root shell via `su`.

mc

  Opens a new terminal with Midnight Commander (a console file manager).

Split

  Split the current terminal by moving a terminal from another, already opened &term; Window, or from another Tab in the same Window.

  This selection opens a short sub-menu with selection options of Horizontally with... and Vertically with... to determine which type of split will be used in the current terminal. Choose one. Then change to another Tab for this same Window, click the terminal Window itself, and the terminal is moved. Or to move between Windows, click on the terminal in the other Window that you want to use to make the split in the current Window.

  Moving between Windows requires that both Windows be opened with either New Window menu selection or with the &oldterm; factory server command line option.

View

  View the output of a terminal running in another Window or another Tab, in this terminal. This selection also opens a short sub-menu with selection options of Horizontally with... and Vertically with... to determine which type of split will be used in the current terminal to view the target terminal's output.

  Choose the appropriate option, and then click on the already opened terminal running on another Tab, or in another Window. The output of that terminal will now also be displayed in the new split terminal. A [V] will show on the Tab label to denote that it is in View mode. Note that the View terminal will accept no input. Use the GUI controls to close it.

  This also requires that the Windows be opened with either New Window menu selection or with the &oldterm; factory server command line option if using terminals from two Windows.

New Tab with...

  Similar to the above two selections, this selection will open a completely new Tab, but it will be created by moving an opened split terminal from the same Window to its own Tab (i.e. it is not split any more), or by moving an already opened terminal running in another &term; Window to the current Window. After clicking the menu selection, then left click on the selected terminal, and it will be moved to its own, new Tab in the current Window.

  Again, this requires that the Windows be opened with either New Window menu selection or with the &oldterm; factory server command line option if moving Tabs from one Window to another.

These are enabled by default and will appear at the top of the menu, and may be disabled. See the New Term Tab Section under Edit Commands for how to enable and disable these.

Below this point on the menu, any user defined Commands would be shown.

The six built-in selections (see above), and any user defined commands will open a sub-menu with four selections:

> New Tab

>   Open the new terminal with its own Tab and full terminal screen (i.e. not split).

> HSplit

>   Split the current terminal in half horizontally, and then open a new shell (or run a command). The split can be resized manually by moving the divider with the mouse. Both terminals are associated with the same Tab.

> VSplit

>   Split the current terminal in half vertically, and then open a new shell (or run a command). The split can be resized manually by moving the divider with the mouse. Both terminals are associated with the same Tab.

> New Window

>   Open the new Tab in a new &term; Window.

The above sub-menu entries can not be disabled or changed.

New entries can be added to the New Term menu from Edit Commands selection of the Settings Menu.

#### Menubar - Edit menu

Search

  Opens a dialog-box for searching the terminal buffer contents. Checkboxes are provided for matching upper/lower case, wrapping, and backward searching.

Search Again

  Repeats the last search of the terminal buffer.

Paste

  Pastes the current selection (from the X clipboard) into the terminal at the current cursor position. This can also be achieved by clicking with the MiddleMouse button.

#### Menubar - Settings menu

&term; configuration is accessed through the Settings menu. Which is available from the main Menubar and the Buttonbar. Tip: It is also available by clicking CTRL-RightMouse on the terminal background.

Tab Preferences

  Opens a dialog-box where configuration options for Tab Classes (tclass) can be set. For more, see the Tab Preferences Configuration Section.

Win Preferences

  Opens a dialog-box where configuration options for Windows Classes (wclass) can be set. For more, see the Win Preferences Configuration Section.

Tab Class (NEW v1.6.0)

  Allows changing the current Tab Class from a sub-menu of all defined Classes. In this case, only the Class for the current Tab is changed. (This effects all split terminals within that Tab too.) See the Terminal Configuration Classes Section.

Win Class

  Allows changing the current Win Class from a sub-menu of all defined Classes. In this case, the selected Class will be applied to the current Window and its various GUI components. See the Terminal Configuration Classes Section.

Edit Commands

  This will open a Window where custom Commands can be defined or modified. These commands are used to open new terminals. See the Edit Commands Section.

Keybindings

  This will open a Window where custom keyboard shortcuts for various &term; functions and other uses can be defined or modified. See the Keybindings Section.

Adjust size

  After adding or removing GUI components (e.g. the Toolbar), there may be a slight discrepancy between the character based terminal window, and the pixel based X window, leaving a small amount of wasted space. This setting will adjust the Window appropriately.

Reset Terminal

  Resets the terminal parameters. This will not clear the screen or move the cursor, but any subsequent terminal output will be reset to the default font and attributes. This is probably only useful if a problem occurs, and the terminal is misbehaving.

Reset and Clear

  Resets the terminal parameters as above, and also clears the screen. All character fonts and attributes are reset.

Color selector ...

  Can be used to drag-and-drop colors into the terminal to change the background color. See the Colors Tab Section for details.

#### Menubar - Help menu

Terminal Help

  Get to this document from within &term;.

About ...

  A few kudos for some of the people behind &term;. See the Authors and Credits Section.

#### Pop-up menu

The Pop-up control menu can always be invoked by clicking with CTRL-RightMouse anywhere within the terminal Window. (It may not always be necessary to hold down the CTRL key to get the pop-up menu, but do not assume this is always so, particularly if a selection is in progress.) It is provided as a simple short-cut to many of the important selections from the main menus. This is especially useful when the Menubar is hidden. Or you are too lazy to move the mouse that far ;-) The following items are available:

New Window

  Opens a new &term; Window. See the section called New Window.

New Shell

  Opens a new Tab with a normal, interactive bash shell in a new terminal.

Root Shell

  Opens a new Tab with a root shell via `su`, running in a new terminal.

mc

  Opens a new Tab with Midnight Commander (a console file manager) in a new terminal.

Remove Term

  Remove the current terminal, and close the associated shell. If this is the only terminal for this Window, then the Window closes too.

Change Title

  Change the Tab title string.

Settings

  Opens a sub-menu with four options:

  - Tab Preferences

  - Win Preferences

  - Edit Commands

  - Keybindings

  - Adjust size

Tab Class (NEW v1.6.0)

  Allows changing the current Class from a sub-menu of all defined Classes. In this case, only the Class for the current Tab is changed. (This effects all split terminals within that Tab too.) See the Terminal Configuration Classes Section.

Win Class

  Allows changing the current Class from a sub-menu of all defined Classes. In this case, the Class will be applied to all Tabs of the current Window (this is the old behavior). See the Terminal Configuration Classes Section.

Bonded Terminal

  Mark this terminal as a bonded terminal in this Window. All bonded terminals share the same input (output is not shared). Note: Use with caution and discretion! This is not appropriate for all commands and situations! There may be security implications to using this (think passwords showing in all bonded terminals), and some commands may not work, or produce unexpected results since the same command is essentially being run concurrently in all bonded terminals.

Show menubar

  Hides the main Menubar on the terminal if unchecked, creating a neater, smaller terminal. The Menubar can be restored using the pop-up menu.

Show toolbar

  Hides the Toolbar if unchecked. The Toolbar can be retrieved using the pop-up menu or the main Menubar.

Show buttonbar

  Hides the Buttonbar if unchecked. The Buttonbar can be retrieved using the pop-up menu or the main Menubar.

Secure keyboard

  This option forces all the keyboard input to be sent directly to the terminal, and bypass anything else. This is useful in the (rare) situation when the same X server is used by many users, and the X server is not using proper authentication methods, thus making it possible for other users to snoop on what you are typing. In such a situation, it is advised that you switch to "secure keyboard" mode before entering any confidential information, such as passwords.

Reset Terminal

  Resets the terminal parameters. This will not clear the screen or move the cursor, but any subsequent terminal output will be reset to the default font and attributes. This is probably only useful if a problem occurs, and the terminal is misbehaving.

Reset and Clear

  Resets the terminal parameters as above, and also clears the screen. All character fonts and attributes are reset.

Open in browser

  Depending on the URL type, this menu selection might also say Send Mail, Open in Browser or Open in File Browser.

  If the mouse pointer is over a URL (for example, an Internet address) when the Pop-up menu is invoked, then this option becomes available to launch a browser (or other appropriate application) to view the URL, send email, etc. See the Launching URLs Section.

## Preferences Configuration

&term; configuration options are set via the Tab Preferences and Win Preferences selections, which are located on the Settings menu, or similar selections on the Pop-up menu. Each will open a Window containing the various options available for that particular Class (e.g. Win). Preferences options are grouped into their own Tabs, according to similar functionality.

Changing any settings in either place, will effect the active Class only. If no Class has been explicitly set, then automatically &term; uses a built-in Class called Default. (If the Class concept is confusing, see the next section, Terminal Configuration Classes.)

The Tab Preferences Dialog

### Tab Preferences

Tab Preferences are those configuration options that can be applied to Tab Classes. These options are all available on a per Tab basis for a high degree of configuration flexibility.

#### The General Tab

While most options are self-explanatory, a brief explanation of all options follows. Most options are simple checkboxes that are either enabled or disabled. After making any changes, be sure to click the Apply button to save and activate changes.

Terminal Class

  Define a new Class from the currently selected settings, essentially cloning the configuration to a new class. Classes can also be deleted here. Refer to the section on Classes for further information on &oldterm; Classes.

Font

  Click the Browse button to choose a font from the GNOME font chooser. Or, you can alternately click the input field, and hand edit the font entry. (There is also a command line option for the preferred font.)

Bold Font (NEW v1.5.2)

  Same as above, but select a (different) font to use for bold fonts if the Use bold font, do not overstrike feature is enabled (see below).

Enable bold text

  Enable bold text for applications that request it (example: man pages).

Use bold text color (NEW v1.5.2)

  Replace the bold text attribute with a color (color is definable in the Tab Colors Tab).

Swap Delete/Backspace

  If your DEL and BS are working backward from what you expect, this will reverse it.

Delete generates DEL/^H

  Try this if having problems with the DEL key.

Enable multibyte support

  Turn on multi-byte support for font characters.

Use bold font, do not overstrike (NEW v1.5.2)

  Allow specification of a different font for bold text only (see above). This should be a font of the same size as the normal font (though different family is OK), and both fonts should be consistent as to whether they are specified as pixels or points.

Silence terminal bell

  Turn off the terminal bell (^G).

Blinking cursor

  If you prefer a blinking style cursor, turn it on here.

No Terminal Border

  The border is a very fine frame around the edge of the terminal Window. Turn on or off here. Turn off No Notebook Border also to get a complete borderless effect.

Open IM (input method)

  Input method is useful for ideographic languages that require a pre-editing stage.

Select-by-word characters

  Defines a list of characters (or character classes) that should be considered 'word characters'. These are used when selecting text by word with the mouse (i.e. double-click).

#### The Image Tab

In the Image tab, you can set various options for the &term; Window background. The available choices are:

None

  If checked, then disable transparent and pixmap backgrounds. In this case, &term; will use the background color as set in Colors. See the Tab Colors Tab Section.

Background pixmap

  This option allows you to choose an image file to be used as background. Press the Browse button to choose an image file. The image can also be scaled or tiled.

Transparent

  With this option, &term; will use a pseudo-transparent background. It is not truly transparent; it just mimics the background of your desktop (root Window), much like a chameleon does. Do not expect to see other Windows through the &term; Window though.

Shaded Background

  Pixmap and Transparent backgrounds can also be shaded, which will "dim" the background. With the slider control, you can choose the degree of shading to use.

Adjust Contrast (NEW v1.5.2)

  You can also adjust the contrast of Pixmap and Transparent backgrounds to brighter or darker values. Click the button on the left to enable, then use the slider to adjust.

Gamma Correction (NEW v1.5.2)

  The gamma correction of the background can also be adjusted to lesser or greater values. Again, click the button, and adjust with the slider control. Remember to click Apply when done.

Tint Background

  Pixmap and Transparent backgrounds can also be tinted with the Tint background checkbox. This will color the background according to the color value in the color selector control to the right. Just click on this to select a color to use for the tint.

Text Shadow

  This will enable font shadowing, which is a technique for drawing a very fine outline around each character when the terminal is in image mode. This can improve readability of text on transparent or pixmapped backgrounds. And just looks cool ;-) See the Tab Colors Tab Section below for selecting the shadow color.

#### The Colors Tab

The Colors tab is used to configure various color settings. &term; fully supports the color extensions used by xterm.

Color scheme

  Some applications are capable of using the color capabilities of a terminal. The way the interaction between an application and the terminal is set up is that the application can request one of sixteen named colors (ANSI colors), such as "blue" or "bright red": for example, mutt mail reader can use red color to show urgent messages. However, it is up to the terminal to decide which exact tint to use for "bright red" or "blue". This collection of sixteen colors is called a palette, or "color scheme".

  &term; supports four color schemes: the Linux console scheme, the Color Xterm scheme, the rxvt color scheme, and a completely customizable color scheme. They all are slightly different: for example, Linux console uses light gray in place of "white", while rxvt uses real white.

  If you have selected the custom option, then all 16 colors (nominally 8 colors and 8 bright colors) can be customized by clicking on the Color palette buttons at the bottom of the dialog.

Foreground/Background Color

  Here you can set the default terminal foreground and background colors, which are used when no colors have been requested by the application running inside of &term;.

  The following options are available: white on black, black on white, green on black, black on light yellow, and Custom colors. How these actually appear depends on the palette selected (for the white on black and black on white options). Custom colors allows you to select the default foreground and background colors individually and separate from the palette.

  Additionally, the user can drag a color from the rectangular box beneath the color wheel from any GNOME color selector or color source and drop it into the terminal. If the user drops the color on a blank space, it will set the background, if the user drops the color on a cell that contains a character, it will change the foreground. This will also automatically change foreground/background type to Custom colors and set the custom foreground or background color.

Foreground Color

  This is the color for font characters and cursor.

Background Color

  The background color to be used for the terminal Window. Except for transparent and pixmap backgrounds, in which case it is ignored.

Text shadow color

  The color to be used for the shadow effect if Text Shadow is enabled. See the Image Tab Section.

Bold text color (NEW v1.5.2)

  Replace bold text with text of this color. See the General Tab to turn this feature on.

Tab label colors are configured in Win Class Preferences.

#### The Scrolling Tab

Scrollbar position

  For the Scrollbar position, select from the list: either Left, right, or hidden.

Scrollback lines

  Set the number of lines that will be maintained in the scrollback buffer. The buffer history can be viewed by using the Scrollbar, or the keyboard (SHIFT-PageUp and SHIFT-PageDown).

Scroll on keystroke

  If this is enabled, then when you have scrolled backward into the buffer, and press any key, the screen will automatically jump back to the cursor position. If not, keystrokes are still echoed to the screen, but may not be visible.

Scroll on output

  If this is enabled, then when you have scrolled backward into the buffer, and any output is echoed to the screen (either by you typing or some process that generates the output), the screen will automatically jump back to the end of the terminal buffer so that the output is immediately visible.

#### The Logs Tab (NEW v1.6.0)

&term; can keep track of user log-ins using standard UNIX utmp style logging. For this to work correctly, `mgt-pty-helper` must be installed correctly. See locally installed man pages for more details on what each of these does.

Update lastlog entry

  Enable or disable lastlog tracking.

Update wtmp entry

  Enable or disable wtmp tracking.

Update utmp entry

  Enable or disable utmp tracking.

### Win Preferences

Win Preferences are those configuration options that can be applied to Win Classes. These options apply to those configuration attributes that are a Windows-only type feature, such as whether the Toolbar is enabled or not, or the colors of the Tab button labels.

#### The General Tab

Basic configuration options that can be applied to Windows Classes.

Window Class

  Define a new Window Class (wclass) from the currently selected settings, essentially cloning the configuration to a new class. Windows Classes can also be deleted here. Refer to the section on Classes for further information on &term; Classes.

Hide menu bar

  Hide the main Menubar at the top of the Window, or not.

Hide tool bar

  Hide the Toolbar if checked.

Hide button bar

  Disable the ButtonBar if checked.

Confirm window closing

  Alert the user before closing the &term; Window.

Use --login by default

  If this option is selected, &term; will launch the built-in, hard-set shells in login mode (the ones at the top of the New Term menu). Your login initialization scripts will be run in this mode. See also the information about `--login` and `--nologin` command line options.

No Notebook Border

  The border is a very fine frame around the inside edge of the GTK Window. Turn on or off here. Turn off No Terminal Border in Tab Preferences also to get a complete borderless effect.

Window Title

  Enter a name to be used as the title that will appear on the X Window titlebar.

#### The Tabs Tab

This is where much of the configuration for the Tabs that represent multi-terminals is done.

Reopen saved terminals

  This option enables saving the current Tab set-up, but you will need to actually do the saving, either manually with the Save Terminals menu selection of the File menu (see above). Or, with the Autosave terminals on exit feature (see below). This just enables/disables these other features. Re-opening will not restore the buffer contents or shell command history. Just the Tab layout and titles. (See the Command Examples Section, for a very useful script that can restore unique history files.)

Restore saved terms paths

  When re-opening Tabs (see above), restore the shell `path` (pwd) as well.

No Numeric Prefix

  Without this checked, &term; will prepend a number in front of the Tab label to designate its position: `[ 3-My Projects ]`. Also, on the Window title. Check this to turn off this feature.

Titled Tabs

  If enabled, the Tab label will match the Window title. Some applications may change the Window Title dynamically (e.g. vim or through xterm escape sequences). In this case, the Tab title will change also to match the Window Title. And conversely, manually changing the Tab label, will be reflected in the Window title. If not checked, then the Tab title stays constant. This should be disabled if you want to be able to change Tab labels with MiddleMouse (and not have it change).

Restore saved terms commands

  Re-execute any &term; customized start-up Commands on application start-up.

Restore saved terms classes (NEW v1.6.0)

  Automatically restore the previous Tab Class (tclass) state on application start-up. This requires that the Reopen tabs option is also enabled (see above).

Autosave terminals on exit

  Save Tabs for the current Class automatically when the Window is closed. Tab configuration can also be saved manually with the Save Terminals menu selection of the File menu (see above). This also requires that the Reopen tabs option is enabled (see above, this section).

  This is different from saving the gnome-session configuration when logging out of GNOME, which saves all &term; Tabs for all opened Windows, and all Classes.

Max Chars in Titled Tabs

  Maximum number of total characters to use for Tab titles. Useful only if Titled Tabs is enabled.

Tab position

  Choose from the droplist the relative position within the Window: top (default), bottom, right, left, or none.

#### The Colors Tab

The Win Preferences Colors tab is used to configure color values of the &term; Tab labels.

Terminal is changing

  The color used for inactive Tab labels to indicate that the terminal buffer is in the process of changing. This is so the user is alerted that something is happening in a terminal, other than the current one. The default is `red`.

Terminal changed

  The color used for inactive Tab labels to indicate that the terminal buffer has undergone a change. This is so the user is alerted that something has happened in a terminal other than the current one, and that the activity has either stopped or paused. The default is `blue`.

Terminal State Default colors (NEW v1.6.0)

  Use to reset the Tab label colors back to the default colors of red and blue.

## Terminal Configuration Classes

&term;, like &oldterm;, allows for different configuration profiles to suit different uses -- different fonts; different start-up Tabs; background colors; presence, absence or position of scrollbars; and so on. These configuration profiles are known as Classes. &term;'s Classes are much more versatile and powerful than &oldterm;'s.

There is always an active Class any time &term; is started. If you don't explicitly specify one, you are automatically assigned the built-in Default Class.

There are two Class categories: Win Class and Tab Class (each with its own default profile). The distinction includes both the scope (i.e. whether the Class pertains to a Tab or a Window), and also which configuration attributes belong to that particular Class. In other words, configuration preferences uniquely belong to one Class or the other. For example, a background image is a Tab attribute only, since backgrounds can be configured individually for each Tab. The same for fonts, font colors, and various other configuration preferences. Most configuration preferences are Tab attributes, which gives a great deal of flexibility.

You can see which preferences belong to which Class from the Tab Preferences and Win Preferences menu selections of the Settings menu. Any changes to the current preferences, will be made to the currently active Class. Again, if no custom Class has been defined, then these changes would apply to the Default Class.

If you are upgrading from pre-v1.6.0 versions of &term;, this two Class distinction is radically different behavior and will require some re-configuration. Notably, start-up Tabs will have to be re-defined since any previously defined Classes will have been converted to Tab Classes (tclass).

To define a new Class, invoke the appropriate Preferences dialog-box from the Settings menu. There are separate menu selections for Win Preferences and Tab Preferences. Then, click the New button near the top, and you will be prompted for a new Class name. The Class is created and activated at this point. You also can select whatever other settings and configuration options you prefer (these changes will be made to your currently opened terminal[s], so you can see what they look like). Before closing the Preferences box, be sure to click Apply.

To activate a specific Class at program startup you can use the `--tclass` (for Tab specific Classes), or `--wclass` (for Window Classes) command line options (see the Options Section below). Classes of both types can also be specified for start-up Tabs, which is the easiest way of having customized configuration profiles automatically in place when &term; is started.

Deleting a Class is roughly the same procedure.

To dynamically change the currently active Class, select either Tab class or Win class from the Settings menu. These will contain a sub-menu listing all defined Classes, from which you can choose one of the selections. Or the same can be done from the control Pop-up menu, accessed with CTRL-RightMouse.

### Summary

Summary of &term; Class features:

- &term; Classes are a way to save differing user-defined configuration profiles. A user can conceivably define many such profiles.

- There is always an active Class in effect. If none is specified, the built-in Class named Default automatically becomes the current Class.

- Configuration preferences belong to one Class or the other, e.g. a background color is an attribute of the Tab Class. And Toolbar being enabled is an attribute of the Window Class.

- Win Class (wclass) attributes are those that logically belong to the entire Window, such as Window title, Tab location.

- Tab Class (tclass) attributes are those that can be defined for each Tab, and includes such attributes as terminal font, background color, transparency, bold font color, etc.

- Tab Classes effect all terminals (i.e if there are any split terminals), that may exist within that Tab.

- Classes can be specified on the command line (`--tclass` and `--wclass`) as one method of specifying a Class.

- Classes can be dynamically changed from the Settings menu.

- Classes can be created and removed using the Tab Preferences and Win Preferences dialog-boxes.

- Start-up Tabs can be associated with both Class types in Edit Commands.

- Class names are case insensitive.

- You can use the same name for both a Win Class and a Tab Class. But note that if a Win Class and a Tab Class have the same name, this does not mean they share the same configuration preferences. They can't, since these preferences are unique to one Class or the other.

## Edit Commands

&term;'s Edit Commands function is a way to customize the creation of new terminals. Edit Commands is accessed from the Settings menu.

A command in this context can be any command recognized by the shell. Typically, this is used to start a new interactive shell (which in most cases would be bash). But actually any command may be run. When the command exits, so does the shell, and consequently so does the Tab (unless it was running a split terminal, in which case the split is removed). So, if simple commands are to be run (i.e. not an interactive shell), they should include some means to keep the shell from exiting, or else the output of the command will be lost when the terminal closes abrubtly. Example:

     tail  -f  /var/log/messages

`tail -f` does not exit immediately like just plain `tail` does (without the -f). See the `tail` man page for exactly what this does, and other options.

Alternately, the `mgt-helper` utility that is bundled with &term; can be used to execute more complex and interesting shell commands (and other uses too). For instance, ps | less does not work as a simple Command since it is difficult for &term; to know how to interpret all shell type conventions (such as piping and metacharacters). But the above example can be run easily with a little help from the `mgt-helper` shell utility, when run as: mgt-helper -x ps | less, which essentially lets the shell handle all the parsing and subsequent execution of the results. Of course, you could always do your own scripts for such things; `mgt-helper` just provides a convenient way of doing more complex commands without having to write your own script.

The Edit Commands Window

There are three categories of commands:

- Common to all Classes: These will always appear on the New Term menu.

- Class Dependent: These will will not show on the New Term menu, and are used to define Start-up Tabs, and belong to a specific Class (see the Terminal Classes Section.). Different Classes can have their own unique start up Commands and Tabs.

- Hardset Commands: These are the built-in commands that appear at the top of the New Term menu by default, such as mc and shell.

Each Command category can be configured in a corresponding Tab within the Edit Commands window.

### The New Term Menu (Common to all classes) Tab

At the top of the Window are four input fields: Name, Path, Command, and Tab Class. The Name is what will appear as the menu selection on the New Term menu. Path is optional, and &term; will change to this directory when executing the command. Command is, of course, the command to execute. Tab Class is the Class that this Tab belongs to (optional as well).

After adding a new Command by filling in the appropriate input fields, click the Add button just below the input fields, then the Apply button near the bottom of the Window. Your command will now appear in the list, and also now on the New Term menu. Commands created this way are always available from the New Term menu (see Startup Tabs below for Tabs that are initialized only for specific Classes).

To create multi-level sub-menus, use a / character for each level. Example:

       Projects/School/Science

This would put a Projects item on the New Term menu, which would open a sub-menu with School on it, which, in turn, would open a third level sub-menu with Science on it. Now clicking on Science would initiate a new terminal, and the Tab will be titled Science (unless running in a split terminal). This is useful for grouping commands that are often used in conjunction with each other. Or to reduce clutter on the New Term menu.

The first word entered in the Command input field, is the command to be executed. Any other words, or characters (separated by white space), will be passed to the command as arguments. So combining commands in one statement, will not work by itself (e.g. `ls -l | less`). Create a shell script to do this for you, then use the script name for the command. (See examples in the Appendix.) Or use `mgt-helper` to circumvent such problems. See the `mgt-helper` Section for all various available options and features.

If you want to start a new interactive shell (command line session), then for the Command input field, you should use the command name to invoke your preferred shell, with appropriate command line options. For most of us, this is `bash`. Example command entry:

      /bin/bash --login

This will open a new terminal, with a normal bash login shell running with our friendly Linux command line waiting for us. See the Appendix for more advanced examples.

You can reposition Command entries by dragging them with the mouse so that they are ordered how you want them to appear on the New Term menu. Newly added entries will appear at the bottom of the list (unless moved by dragging).

Any Command you define here, can also be accessed through Keybindings as well. See the Keybindings Section.

### The Startup Tabs (Class dependent) Tab

Defining a Class Dependent command is much the same as above. The main difference is that these never appear on the New Term menu, and can be automatically initiated on program start-up.

Class Dependent Tabs can also be associated with different Win Classes, so that conceivably there can be many Win Classes, each with a unique start-up configuration. See the Window Class listbox in the lower righthand corner for selecting Win Classes (these must already exist).

Any commands in this Tab's list, will be executed on program start-up with the appropriate Win Class (or the `Default` Class if no Class is specified), thus creating the desired Tabs automatically, as long as the Don't open startup tabs checkbox at the very bottom of the Window is not checked.

You can either create new start-up commands through the same steps as outlined above (Add button, etc), or you can copy commands from the New Term Menu Tab with the Get button. Just highlight the command you want to copy with the mouse first, switch Tabs, then click on Get, and then Apply, of course.

In addition to specifying a Win Class that applies to the entire Window, you can also specify Tab Classes using the input field in the top righthand corner. Remember, a Tab Class only applies to that one Tab.

Start-up Commands do not appear on the New Term menu, but you can use the Get feature to have the same Command in both locations.

### The New Term Tab (NEW v1.5.2)

This Tab contains configuration options for controlling which of the built-in, hardset entries appear on the New Term menu. These are the default selections that normally appear at the top of the menu (e.g. Shell and mc).

These can be individually disabled/enabled. There are six possible entries:

Shell

  A normal, user, interactive bash shell is started.

Root

  A root shell is launced with `su -`.

mc

  The Midnight Commander, a text based file manager, is started.

Split

  The terminal is split with the new terminal being moved from another Tab or Window.

View

  A terminal is opened in view mode, to view the activity in another terminal from another Tab, or another Window.

New Tab with...

  A new Tab is created by moving an existing split Tab from the current Window, or another terminal from another Window.

These are all explained in more detail in the Menu - New Term Section. Please refer to that.

You can also choose to disable all default selections with the hide all hardset items button.

### Editing and Deleting Commands

To make any changes to an existing &term; Command, click on the Command with the mouse, and then click the appropriate button: Edit to modify this Command, or Remove to delete this Command. If editing, then once you've changed the input fields at the top, click the Update button. For both situations, click Apply to have your changes take effect. Or as our fearless leader calls it, the make it so button ;-)

## Keybindings

This is where keyboard shortcuts for &term; functions and key definitions for various other purposes may be customized. It is accessed from the Settings menu. This selection will open a Window that displays the current settings. These may be customized to suit individual preferences by using the input fields at the top of the Window.

The Keybindings Window

### Actions

At the top of the Window, there is a list of &term; Actions, with an initial entry of Shell->New Tab. Click here to see all available built-in Actions that can be customized. The input field to the right is labeled String and the last input field is labeled Keybinding. The Keybinding field is where you enter your keyboard combination for a particular Action or usage.

To define a new shortcut, first select an item from the Action drop-down list with the mouse, then click on the Keybinding field, and then press the keyboard combination you want to use. Do NOT type the keystroke representations. Example: if you want SHIFT-F1, then press SHIFT-F1, and do not try to spell it. There is no limit on the number of keys that can be used for the key binding definition. This is your choice. The String field is not required for simple Actions such as these.

Example, shortcut to remove the current Tab:

Open the Action list at the top by clicking the button just to the right. Scroll down the list, and find Remove Term. Click on this, which closes the list. Now go all the way over to the Keybinding field, and click on the blank field to activate it. Now press whatever key combination you prefer. For example, press: CTRL-SHIFT-DELETE. This will be the new shortcut!

After setting the Action and the Keybinding, click on Add, and then, of course, at the bottom of the Window, Apply to make your new addition permanent. Now try it!

### Strings

The String input field gives even more flexibility for defining custom Actions. It can be used with the special Escape Sequence, Command ->New Tab, and Switch To Actions (available from the drop-down list on the far left).

Use Escape Sequences to associate any string with a keystroke combination. This is helpful for forcing problem keys to do what you want, or to perform some custom function that you do repetitively.

As one example, select Escape Sequence from the list, and enter the following text to the String field:

echo hello world\n

And then, click the Keybinding field, and press F7, then click the Add, and then Apply. Now press F7 to see the results. You should see:

     [bash]$ echo hello world
     hello world

A more useful example: Select Escape Sequence from the Action list and then enter:

multi-gnome-terminal --add-tab --tpath=`pwd`\n

into the String field. Then whatever key combination you like for Keybinding (e.g. F9), then click Add, and lastly Apply. Now try it ;-) This should open a new Tab in the same Window and also land you in the same directory as your current directory.

You can also use any of &term;'s raw escape sequences instead of the command syntax as above. The basic ones are:

     echo -e "\033]NT;<tab_name>\011<path>\011<command>\007"
     echo -e "\033]HS;<term_name>\011<path>\011<command>\007"
     echo -e "\033]VS;<term_name>\011<path>\011<command>\007"
     echo -e "\033]NW;<term_name>\011<path>\011<command>\007"
     echo -e "\033]WT;<term_name>\011<path>\011<command>\007"

In this order, these create: a New Tab, a Horizontal Split, Vertical Split, a New Window, and lastly a New Window with startup Tabs.

An interesting example:

      echo -e "\033]HS;$(hostname -s)\011 \011ssh $(hostname)\007"

This assumes you have an existing `ssh` connection to another host, and will open a second `ssh` connection to that same host in a split Tab.

Also, any custom Commands that have been created through Edit Commands, are automatically available for use as a Keybinding. To access these, open the Actions list in upper left hand corner, and select Command->New Tab (or any of the Command-> * functions), and then click the button to open the list next to the String input field. This list now will contain all of your custom defined Commands. Now select one, and chose your shortcut key of choice, and then save as usual.

The Switch To Action can be used to define shortcuts for switching to specific Tabs. In the String field enter the ordinal number of the Tab to switch to, and then enter a shortcut key in the Keybinding field. So String would be 1 to switch the first (furthest to the left) Tab.

The String field will also recognize common meta-characters such as `\n` (as above) for newline, and also `\r`, `\t`, etc. `\033` is used to represent the escape character. For instance, my keyboard generates `^[[1^` for CTRL-Home. This would be represented in the String field as `\033[1^`.

And, the String field will also recognize any octal ascii representation. Example: `\141` octal equals the letter a. This may be useful for non-printable characters. See `man ascii` for a complete listing of values.

### Modifying Keybindings

Editing and removing key bindings, is similar, but first highlight the one to be changed from the main listbox, by clicking on it. Then either click Update to modify, or Remove to delete it. And again, click Apply at the bottom of the Window.

You can also easily re-set the default key bindings here. And also specify a different modifier key for the control Pop-up menu (default is CTRL-RightMouse, though often just RightMouse works).

## Mouse usage

The mouse can be used to select (copy), and extend-select text, paste text from other terminals or applications, and also bring up control menus, as well as select (and move) other GUI components.

Note that some text applications may take complete control of the mouse. &term;'s mouse handling features are not available in such cases. This is true of vim, w3m, etc. which will provide their own mouse handling.

### Selection

The following assumes a standard three-button mouse that has not been made left-handed via the control center. Left-handed mice will of course work, but with the right button instead of the left one, and so on.

The LeftMouse button can be used to initiate a selection. If the mouse button is held down and dragged, then characters, words and lines are selected individually.

If you drag past the boundaries of the Window, the screen and selection will scroll to keep up. So, for instance, you can select into the non-visible part of the scrollback buffer, by dragging the mouse past the upper Window border and scrolling as the selection is extended.

If the LeftMouse button is double-clicked, then the selection will be by word-characters. Hold the mouse button down on the second click to drag the mouse and enlarge the selection. The word-characters are defined in the General options tab of Preferences dialog-box.

Finally, if the LeftMouse button is triple-clicked and held, whole lines are selected as you drag the mouse up and down.

The RightMouse button can be used to extend the selection. Simply scroll to where you wish to extend the selection to, and click the RightMouse button in the desired place. Again, single, double and triple clicks will result in by-character, by-word, or by-line selection.

For all cases, releasing the mouse button automatically copies the selected text into the clipboard, so that it may be pasted to other applications. Note that any screen output will clear the highlighting of the selection, but it will still be kept on the X clipboard.

If there is no URL match on screen beneath the pointer (see below), CTRL-MiddleMouse will reset the X selection mode.

In applications that take control of the mouse, and don't have their own selection capability (e.g. w3m), the application can be bypassed with SHIFT-LeftMouse. This does not give access to all &term; mouse features, however.

### Pasting text

If the middle mouse button is pressed, then the current selection is pasted into the Window. This can be used to transfer text from other applications, as well as from other locations within the same terminal Window.

If you only have a two-button mouse, then your X server probably has a method of emulating the middle mouse button. The most common method is to emulate the middle mouse button by simultaneous pressing of left and right mouse buttons. Refer to your X server documentation for further information.

SHIFT-INSERT can be used as a keyboard shortcut for pasting.

### Wheel mouse

If you have a wheel mouse (which sends mouse button 4 and mouse button 5 events), then you can use the wheel to scroll up and down through the scrollback buffer. If properly configured for X, no additional configuration should be required.

### Pop-up Control Menu

The mouse pointer can also be used to bring up the Pop-up menus, which can be used to open new &term; Windows, open new Tabs and to access many other &term; features. There are two such menus: the New Term menu which is accessed with CTRL-LeftMouse (see the New Term Section.). And the control Pop-up menu, accessed with CTRL-RightMouse (see the Pop-up Menu Section for more details).

### Launching URL's

&oldterm; instituted the concept of live URLs. These are URLs of various types that appear on the terminal window as text and that the application is able to discern just what they are, e.g. a HTTP style URL to denote a WWW document. This added quite a bit of additional functionality to the plain old terminal interface. Now, actions could be taken based on whatever appears as raw text in the window.

&term;, like &oldterm;, can be used to select URL's (Uniform Resource Locators; such as `http://www.gnome.org`, or `file:///usr/share/doc/mgt/index.html`, or `cristiano@example.com`) from the text displayed in the terminal Window, simply by moving the mouse over the URL text. The URL will be emphasized, by being redrawn with an underscore, and the mouse pointer will change to a pointing hand to let you know it is live.

&term; also now understands email addresses and file path names, in addition to traditional `http://` type URLs. Invoking the control-menu while over a highlighted URL will add a new option to load that URL into an appropriate application, for instance a mail client if the URL represents an email address. The menu selection text will reflect what the appropriate client should be.

CTRL-MiddleMouse is a shortcut to launching the URL with the appropriate application immediately.

&term; includes a script, `mgt-helper` which can extend this feature so that text based applications can be launched in their own Tabs or Windows. See the `mgt-helper` Section for more information on what this script can do in conjunction with &term; to greatly extend and customize URL handling.

### Drag and Drop

Drag and drop can be used for a number of operations within the terminal.

Dragging Files and URLs

  If files are dragged into the terminal, then their full filename is pasted into the Window. URL's can also be dropped in this manner.

Dragging Colors

  A color can be dragged from another gnome application, or from the color selector into the display. If it lands on a character, it sets the foreground color, otherwise it sets the background color. Refer to the Tab Colors configuration section.

## Command line options

The following options can be used to start &term;. These will over-ride any saved configuration settings.

- `--version`

  Show the current &term; version information, then exit.

- `--usage`

  Show all command line options, including various GNOME and GDK options, then exit.

- `--help`

  Show command line options, including a brief description of each, then exit.

- `--background COLOR`

  Used to specify the background color for the terminal at startup. The COLOR can be any form accepted by your windowing system.

- `--class WM_CLASS`

  Specify a Window class name for X (this is different than `--tclass` and `--wclass`, which are purely &term; functions).

- `--display DISPLAY`

  Specify the X display to be used.

- `--command CMD ARGS, -e CMD ARGS`

  Executes the command CMD with its arguments ARGS on startup. No arguments beyond this one will be processed by the terminal. This behavior mimics the `xterm -e` behavior.

- `--execute CMD ARGS`

  Same as `--command` above, included for compatibility.

- `--font FONT`

  Sets the font of the terminal to FONT

- `--foreground COLOR`

  Sets the foreground of the terminal to COLOR.

- `--geometry GEOMETRY`

  Specifies the startup geometry for this terminal. The geometry specifies the desired width and height in terminal characters. For example: `--geometry=80x40` will create an eighty-column by forty-line terminal. You can also specify the location of the terminal Window on the screen; for example, `--geometry=80x40+100+200` will create a Window whose top left corner is 100 pixels to the right and 200 pixels down from the top left corner of the screen, while `--geometry=80x40+100-200` will give a Window whose bottom left corner is 100 pixels to the right and 200 pixels up from the bottom left corner of the screen.

- `--login`

  Make &term; launch the built-in shell (from the New Term menu) in login mode (it will run all of your login initialization scripts in this mode).

- `--nologin`

  Make &term; only launch a shell, without running any login initialization scripts. This is the default, unless you have selected Use --login by default in the Preferences dialog.

- `--noutmp`

  Indicates that this and the associated shell should not be registered in the system database of users logged into the computer.

- `--utmp`

  Indicates that the user wants this terminal to be registered in the system database of users logged into the computer (the utmp database). This is the default.

- `--lastlog`

  Always create a `lastlog` entry for each terminal login.

- `--nolastlog`

  Do not create a `lastlog` entry for each terminal login.

- `--wtmp`

  Requests that this session will be logged into the system records for users that have logged into the system. This is different from `utmp' because this keeps track of who logged in and logged out of the system, independently of whether it shows up in the list of users.

- `--nowtmp`

  Requests that the session be not logged into the system records.

- `--title TITLE, -t TITLE`

  Makes &term; use TITLE for the Window title.

- `--termname TERMNAME`

  Makes &term; use TERMNAME as the value of the `TERM` environment variable. This is generally not needed, but is available for those who find they do need to change it.

- `--start-factory-server`

  Try to start the TerminalFactory service for this terminal (see below).

- `--use-factory`

  If there is already a terminal process started with `--start-factory-server` option, then running the command `multi-gnome-terminal --use-factory` will create a new terminal Window owned by the existing terminal process. In other words, it will have the same effect as choosing File New Window in the existing terminal.

  If there is no TerminalFactory running, then this option has no effect.

- `--solid`

  Force a solid background color, i.e. turn off transparency or pixmap backgrounds.

- `--pixmap FILENAME`

  Specifies the image filename to be used as the background for this terminal Window.

- `--shaded`

  Requests that the background be shaded (for use with `--transparent` and `--pixmap`).

- `--noshaded`

  Requests that the background remain untouched (no shading is applied).

- `--transparent`

  Requests that the terminal should run in pseudo-transparent mode, making the background of the terminal Window be the same as the background of your root Window. It is not truly transparent since other Windows will not be visible through the terminal Window.

- `--icon FILENAME`

  Specifies the filename that contains the icon image that should be used for &term; when iconified (as long as your Window Manager supports icon hints).

- `-s`, `--tclass` CLASSNAME (NEW Behavior v1.6.0)

  Specifies the Class for this Tab only. This effects all terminals within the Tab as well, but other Tabs may have belong to other Classes.

- `-S`, `--wclass` CLASSNAME (NEW v1.6.0)

  Specifies the Class shared by all Tabs of this Window. This is essentially the old behavior of `--tclass`.

- `-w`, `--add-window`

  Launch a new Window from the parent Window, as a sub-process. This will automatically open one Tab. This can be combined with various other options listed below.

- `-W`, `--add-window-wt` (NEW v1.5.2)

  Launch a new Window from the parent Window just as the above `--add-window`, but also open any start-up or saved Tabs for the current Class as well.

- `-A`, `--newapp`

  Use this option to force a completely new instance of &term; so that the options listed below (e.g. `--add-tab`) can be utilized in a new Window as opposed to the current one.

- `-T`, `--add-tab`

  Add a new Tab. `--add-tab` can be used to add a Tab to a new Window that is being created (see `--add-window` and `--newapp`), and also to dynamically add a new Tab to the Window that invokes the command. Example:

        multi-gnome-terminal --add-tab

  Something fun to use with Keybindings. See example below for combining various command line options.

- `-n`, `--tname NAME`

  Use this NAME for the new Tab label and shell being launched. If white space is included, use quotes.

- `-h`, `--hsplit`

  Split the Tab or Window being created horizontally in equal parts.

- `-v`, `--vsplit`

  Split the Tab or Window being created vertically in equal parts.

- `-p`, `--tpath PATH`

  Change to this PATH when starting the new Tab.

- `-c`, `--tcommand COMMAND`

  Use this COMMAND to launch the new shell. This can be used in conjunction with `--add-tab` to create a new Tab or with `--add-window`. Successive `--tcommand`'s can also be invoked so as to pass arguments to the first `--tcommand`. Or if white space is included, the command must be in quotes. The first word should be the command in this case, and any additional words, or characters separated by white space, would be arguments to the command. Example:

        multi-gnome-terminal --add-tab --tname="MGT Man Page" \
         --tcommand="man multi-gnome-terminal"

  This creates a new Tab with the &term; man page opened. Obviously, something more suited for a key binding shortcut. Remember, once the command exits, so does the Tab.

- `-x COMMAND`

  As above, use this COMMAND to launch the new shell, but quoting is not required with this option.

- `-N`, `--tnext`

  When creating split terminals, force the split to the next terminal being created. This is to aid in the positioning of terminals within the Window.

- `-P`, `--tprev`

  When creating split terminals, force the split to the previous terminal being created.

- `--nowait`

  Normally, &term; waits to make sure a new terminal has in fact been created before proceeding. This option bypasses this safety net, and thus is dangerous for general usage. It should not be used -- unless you have a very good reason, and know what you are doing. In most cases, it simply is not warranted.

You can use more than one option at once. Example:

      multi-gnome-terminal --transparent \
        --font -b&wh-lucidatypewriter-medium-r-normal-*-14-*-*-*-m-*-iso8859-1 \
        --add-window --tname="My Window" --tcommand=vi \
        --tpath=$HOME/multignometerm --tclass=Default --add-tab \
        --tname=MGT1 --hsplit --tname=MGT2 --vsplit --tname=MGT3 \
        --tcommand=mc &

This opens a new transparent Window and one Tab with `vi` running, and then adds another Tab (MGT1) which is split horizontally first, and then vertically, where Midnight Commander is then launched. Who says the command line is not useful? ;-)

## Environment

The following variables are set by &term;:

- `TERM`

  This variable is set to xterm by default. Some curses implementations and applications based on curses might want the value to be xterm-color, color-xterm or xterm-debian to support color. You might need to change this setting if your application does not display in color to one of those values, or for other special case situations. This can also be set via the `--termname` command line option.

- `COLORTERM`

  This variable is set by &term; to gnome-terminal. Various applications (especially the Slang-based applications) use this setting to determine whether the terminal supports color or not.

- `WINDOWID`

  This variable contains the X11 Window identifier. In some situations, this is used by applications to modify the contents of the Window, or to provide special effects.

## Helper Applications

&term; comes with two supplemental programs to help extend its functionality into other areas.

### mgt-helper

`mgt-helper` is a bash script meant to be used in conjunction with &term; to extend &term;'s usefulness in a shell environment. Which is where a lot of what we do at the command line winds up -- in bash, since this is the default shell for Linux, and common on many Unices.

The script itself is a collection of subroutines that can be invoked from within &term;'s Edit Commands or Keybindings features, and in some cases, used on the command line with other &term; options. These subroutines are essentially independent of each other, and should be invoked individually.

Some of the more interesting features are: the ability to have a custom bash history file defined specifically for a Tab (what you get with the UpArrow key); the use of text based applications as GNOME Document (URL) handlers in a split or self-contained Tab; and the ability to run complex, compound commands from Edit Commands to initialze Tabs and terminals.

There are some known limitations: `mgt-helper` is very much bash-centric, and most of the routines will probably not work with other shells without modification (please send patch :). The URL Handlers only work on Linux.

#### Configuration

There are a number of variables that can be defined to alter `mgt-helper's` behavior and set user preferences. These are all listed in the script itself, though some may be commented out.

It is highly recommended that such user or site preferences be put in another file. This can be `/etc/mgt-helper.rc` for site-wide preferences, or `$HOME/.mgt-helper.rc` for individual user preferences. Both of these files are checked by `mgt-helper` automatically, with the latter taking precedence over other files, and the defaults as set in the script itself.

In addition, since these configuration files will be sourced by Bash, any other variables, or manipulation of the bash environment, can be added at your discretion. For instance, you could set Bash's `TMOUT` (time out) variable, and even base this action conditionally on other environment factors, or the contents of the command line. Or you could check the command line contents, see if a url handler is being invoked, then check the URL itself, and alter the default handler dynamically based on certain conditions. For instance, use Mozilla for your favorite multi-media sites, and w3m for less interesting HTTP sites. Or perhaps use the document extension to determine the choice of browsers, e.g. Mozilla for shockwave, or `wget` for web-hosted RPMs.

#### Document (URL) Handlers

This feature is provided so that text based applications may be used with GNOME document handling inside &term;. Presumably so that such documents can be opened in a split terminal or Tab.

This is basically a feature of GNOME that allows user defined applications for different document types. Typically, these are GUI apps. When the mouse is over a type of URL that &term; can identify, the URL is highlighted by an underscore. It can then be launched with CTRL-MiddleMouse. Which application is used, is typically configured in GNOME.

To change the default GNOME behavior, you will first have to set `mgt-helper` with the appropriate command line option (e.g. `-u`) as the handler for GNOME (see below). This can be done through the GNOME menu interface, or by directly editing `$HOME/.gnome/Gnome` with a text editor (carefully!).

Secondly, be aware that now, any GNOME application that tries to access this feature, will be using `mgt-helper` as the application of choice, even if it is some other application altogether. This means that there must be alternate handlers set up, preferably in either `$HOME/.mgt-helper.rc` or `/etc/mgt-helper.rc`, since other applications don't know about &term; and its features. In short, that just will not work at all (unless alternate applications are provided for). Defaults are provided, but probably won't work on some systems. See the script for appropriate variable names, and re-define as needed.

`mgt-helper` will use sane defaults for all URL handlers, but you can over-ride these by setting user or site preferences in the configuration files.

Note: This feature only works on Linux at this time.

#### Command Line Options

This is a list of available `mgt-helper` command line options. See examples in next section. The basic syntax is:

      mgt-helper [option] CMD_OPTION [arguments]

The following general options may be combined.

- `-D`

  Turn on verbose, debugging mode, which writes some debug type output to the screen and also to `/tmp/mgt-helper.debug`.

- `-r` RC_FILE

  Specify this RC_FILE, which is parsed after any other config files, and will over-ride any previously defined settings.

- `-T`

  Force this Command to use a full Tab.

- `-H`

  Force this Command to a horizontally split Tab.

- `-V`

  Force this Command to a vertically split Tab.

- `-W`

  Force this Command to a New Window.

- `-WT`

  Force this Command to a New Window with appropriate start-up Tabs for the current Class.

- `-A` ACTION

  Use this &term; ACTION for output of the Command. Example: `--add-tab`, or `--add-tab --tclass myclass`. Don't get carried away with this, as all actions will not work. Notably, `-x`, which is used by `CMD_OPTIONS` listed below. And, may not be appropriate for all `CMD_OPTIONS`. Be sure to quote if there is any whitespace.

Use only one `CMD_OPTION` option at a time (but can be combined with general options above).

- `-h`, `--history` EXTENSION

  Specify a user defined, custom bash history file for this terminal/Tab, where EXTENSION is a user-defined, unique string. This probably only works with bash right now. Use with Edit Commands.

- `-u`, `--url-handler`, `--http-handler`

  Set `mgt-helper` as the GNOME URL Handler for HTTP (WWW) URLs. Also can be used for HTTPS URLS. See full example syntax below. You will have to either define this in the GNOME menus as the Document handler. Or, hand edit your `$HOME/.gnome/Gnome` file and set accordingly. The idea here is to open a new Tab (or split terminal), with a text client running. There is no default HTTP handler set; `mgt-helper` will look for `w3m`, `links`, and `lynx` and use whatever it finds first. Though you can set a preference for this (and other handlers too).

- `-f`, `--ftp-handler`

  Set `mgt-helper` as the GNOME URL Handler for FTP URLs, similar to above. Default handler is whatever is used for HTTP above.

- `-m`, `--mailto-handler`

  Set `mgt-helper` as the GNOME URL Handler for mailto style URLs (i.e. email addresses), similar to above. Default handler is `mutt`.

- `-F`, `--file-handler`

  Set `mgt-helper` as the URL Handler for files, similar to above. Depending on what `mgt-helper` thinks of the file, it will either provide some information itself, or spawn a file manager (default is Midnight Commander).

- `-x`, `--execute`

  Use this option to run complex, compound commands from within &term;, e.g. as an Edit Commands command. For example, a command like `ps | less` does not work from Edit Commands. But by wrapping this in `mgt-helper` (or another script), it does work, since now the shell is handling the parsing of the command string (which happens to be shell constructs).

- `-U`, `--user-guide`

  Open this User Guide in a Tab (or split terminal). Use with Edit Commands, or from the command line.

- `-s`, `--ssh` [ssh args] `HOST` [command]

  Use `mgt-helper` as a `ssh` wrapper. This is probably only useful where the `sshd` daemon may be running as another user, and thus breaks our GNOME URL Handling tricks. Use with Edit Commands, if needed (ie URL Handlers don't work).

- `-S`, `--su`

  Use `mgt-helper` as a `su` wrapper. `Su` will also break the &term; URL Handling extensions. Use this instead of the &term; Root menu selection, or with Edit Commands.

- `-g`, `--google`

  Search Google from Edit Commands.

- `-lg`, `--lin-google`

  Same as above but searches on google.com/linux only.

- `-l`, `--lookup` [WORD]

  Look up a word in an on-line dictionary. This will use the `dict` command if availalbe, otherwise the Merriam Webster on-line dictionary is used. Provided as a convenience feature only. If WORD is omitted, then user is prompted for word to look up.

- `-d`, `--debug` COMMAND [args]

  This is a simple troubleshooting aid to capture error output from shell commands (not &term; internals) that might vanish quickly otherwise. For instance, you have a command to open a Tab, but there is some error and the Tab closes too quickly to see what happened. For use with Edit Commands.

- `--show-all`

  This dumps all bash variables from the `mgt-helper` environment to `STDOUT`, and also writes the same data to `/tmp/mgt-helper.debug`. For simple troubleshooting purposes.

#### Examples

A few quick examples of `mgt-helper` usage, of no particular value other than to illustrate the kinds of things that can be done. By and large, these examples are meant to be used with Edit Commands.

##### Create a custom bash history file

      mgt-helper -h my_tab

This will create, and subsequently use, a bash history file named `.bash_history-my_tab`, whenever this Tab is opened. So what you get with the UpArrow will only be command history that is used in this Tab. It also uses the `mgt-helper` variable `SHELL_CMD` to start the shell. Use with Edit Commands.

##### Read my mail on another system, in such a way that URL Handling works like we want

      mgt-helper -s -t some_host.org   mutt

This essentially translates out to: `ssh -t some_host.org mutt`, and is only useful to make sure that URL Handling extensions are sure to work. Use with Edit Commands.

##### Create a shell/Tab that times out in 15 minutes

      mgt-helper -x export TMOUT=900; bash --login

Bash's `TMOUT` feature only works for interactive shells, and while the user is sitting at the bash prompt. Use with Edit Commands.

##### Show who is logged in and what they are up to

      mgt-helper -x w |  sed 's/   //' |  /usr/bin/less -Ps"`hostname -s`\: who is that"

We trimmed a little gratuitous whitespace with `sed` here too, just so it fits better. Use with Edit Commands.

##### Show file listing with current directory

      mgt-helper -x ls  -laF  | /usr/bin/less -P "All files for\: `pwd` `date`"

Use with Edit Commands.

##### Create a New Mail Tab for `mutt`

      mgt-helper  -x while : ; do mutt -H /dev/null ; clear ; done

This will create a Tab just for composing new mail in `mutt`. (It is not useful for replying, just starting a new mail from scratch.)

##### Setting GNOME Document Handlers

If you want to hand edit your `~/.gnome/Gnome` file to set up URL Handling for use in &term;:

        [URL Handlers]
        file-show=mgt-helper -F "%s"
        mailto-show=mgt-helper -m "%s"
        http-show=mgt-helper -u "%s"
        https-show=mgt-helper -u "%s"
        ftp-show=mgt-helper -f "%s"

We are just showing the relevant ones here. The handlers that &term; will use are defined in the script as:

        HTTP_HANDLER (undefined, script will look for w3m, links, or lynx)
        FTP_HANDLER (undefined, and uses same as above by default)
        MAILTO_HANDLER=mutt
        FILE_HANDLER=mc (though some files are handled by mgt-helper itself)

And you must set alternate handlers for non-&term; applications (if you use them elsewhere):

        GNOME_HTTP_HANDLER
        GNOME_FTP_HANDLER
        GNOME_MAILTO_HANDLER
        GNOME_FILE_HANDLER

Again, it is best to set these in `$HOME/.mgt-helper.rc`.

##### Advanced usage: Customizing URL Handlers

OK, let's assume all this makes sense, and we have URL handling set up in GNOME, and `mgt-helper` has been configured enough to know it works OK, including Document handlers in GNOME. Now, let's do something a little more interesting. Let's look for specific file types, and dynamically alter our Handler, and `mgt-helper's` behavior based on the URL's file type.

Let's say we often download source tarballs, that are gzipped tar archives. We don't need a web browser to download this. And what do we do right after downloading? We unpack it! So we make a custom handler for this situation. Put this in `~/.mgt-helper.rc`, and you are there:

     # Check the incoming command line to see if we are handling, and if it is a tgz, etc.
     if [ "$1" = "-f" -o "$1" = "-u" ] && [ -f $PTS_FILE ] && echo $2 |grep "\.tgz$\|\.tar\.gz$\|\.Z$" >/dev/null;
      then

        # Make a temporary directory using the base filename. Must be exported.
        export dldir=/tmp/`basename $2 |sed 's,\(\.tar\.gz\|\.tgz\|\.Z\)$,,'`
        mkdir -p $dldir

        # Get our current /dev/pts info from MGT (special file created
        # during handling) that is necessary. $PTS_FILE is defined in mgt-helper
        # already as ~/.mgt_tty.
        pts=`cat $PTS_FILE`

        # Make sure to remove it now so it does not cause trouble later!!!
        rm -f $PTS_FILE

        # Now do the voodoo.
        exec /usr/bin/multi-gnome-terminal --nowait --add-tab --tname `basename $dldir` -x \
        "mgt-helper -x cd $dldir && wget -P . $2 && tar zvfx `basename $2` && (bash ;:) ||\
         read -p \"Failed, press ENTER to continue...\"" >$pts || exit 1
     fi

The first part is just shell stuff to get ready. First find if we are going to be the handler here, and that we have the file type we want, and then create a tmp directory to download into. Next, get our `/dev/pts` info (important!) that &term; feeds us just for this purpose so &term; will know where to open a new terminal, then remove the file to keep things clean for the next application that might come calling. This is the trigger we need, to know if the calling program is &term; or not. If not, we need to provide an alternate application (this is done elsewhere in `mgt-helper`).

Now our final command does this: We will be creating a new Tab that will be home to all our command line voodoo. Which is: change to our new directory, use `wget` to download our file, if successful then unpack it, and if all is still well, start a new shell running in our newly created Tab. If anything fails, we get notified with the original error message still displayed on screen.

Note we made a recursive call to `mgt-helper -x` in the command passed to &term;. It is much better to let a shell expand compound commands like we are using here and interpret metacharacters (though it certainly does not have to be `mgt-helper` that does this). Also, `mgt-helper` uses certain variables we might have wanted to take advantage of here: `$MGT` in case there is more than one version installed, or its not in the `$PATH`, and `$URL_ACTION` which can be used to set a preference for how the new terminal is created, e.g. a split, a new tab, or a new window.

One final note ... this only works on a fully qualified URL, e.g. `http://someplace.org/somepath/some.tgz`.

Similar customized handlers could conceivably be designed for other file types, or for specific sites.

### mgt-pty-helper

`mgt-pty-helper` is a simple, one dimensional program that facilitates proper updating of the `utmp` (`wtmp`) log database. This records who is logged in, and what they are doing, and is used by other programs like `who`. `mgt-pty-helper` does this so that &term; itself does not have to be suid root, and thus is a more secure way of doing things.

For this to function properly, `mgt-pty-helper` should have permissions set `chmod g+s`, and the group owner should be the same as the group owner of the `utmp` logs (possibly `/var/log/utmp` or `/var/log/wtmp`). The correct group ID could be tty, or utmp, or something else altogether, depending on platform and packager. If you have installed from raw source, you will have to do this yourself. RPM packages should be doing this for you, though you may want to check and make sure it is working correctly.

If tracking this information is not important, then not to worry ;-) Once installed, there is no user inter-action with `mgt-pty-helper`.

## Authors and Credits

Cristiano De Michele is the creator and author of &term;.

Various people have contributed to &term;, in one way or another:

Most of the new features of &term; are the work of Cristiano. Other contributing developers that have made significant contributions include Soeren Sonnenburg and Guillermo Ontanon.

Erik Bourget, Stefan Kost and Jan Oberlaender have also contributed.

Multi-gnome-terminal is partially based on the original work of Michael Zucchi, Miguel de Icaza, Erik Troan and others. &term; also includes additional influences from screen, konsole, xterm, and Eterm.

This Guide was updated by Hal Burgiss for &term; and retains some of the original content written for &oldterm; by Miguel de Icaza and Michael Zucchi with minor contributions by Alexander Kirillov. Please send comments or suggestions on this documentation to multignometerm-devel@lists.sourceforge.net.

### Bugs, Feature Requests, and Mailing Lists

- Bug Reports
- Feature Requests
- Mailing Lists
- Patch Tracker
- Home Page

## License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is included as an appendix to the GNOME Users Guide. You may also obtain a copy of the GNU General Public License from the Free Software Foundation by visiting their Web site or by writing to

     Free Software Foundation, Inc.
       59 Temple Place - Suite 330 Boston,
       MA 02111-1307 USA

## Appendix: Command Examples

The following will include some examples of things that can be done with &term;'s Edit Commands feature. The examples below represent the command input field (third field) at the top of the Edit Commands Window. You will have to supply your own Command name, and path if wanted. Note that some of the examples are included with the `mgt-helper` script.

Starting shells:

### Start a login shell

The most typical usage is to start a normal, interactive shell. The `--login` bash command line option above is optional.

bash --login

### Start a remote shell with `ssh`

But we can also start a remote shell on another host:

ssh some_host.example.com

### Start a mail reader

We can also start any text based program automatically, like a mail reader, or news reader:

pine

### Specify a specific mailbox

You can watch multiple mailboxes with multiple instances of your mail reader. This way the Tab labels will change color to alert you to new mail in that mail box.

mutt -f ~/Mail/inbox

And another command for another mailbox:

mutt -f ~/Mail/multignometerm-usability

We could get really fancy and create a special Class, maybe titled mail, and create a custom start-up Tab for each mailbox we want to access.

### Start a text web browser

w3m ~/my_bookmarks

In fact, you could create a sub-menu with your favorite links all in their own sub-menu:

> - w3m/freshmeat
> - w3m/slashdot
> - w3m/sourceforge
> - w3m/user friendly

### Start a remote shell and start a program on the remote host

ssh -t some_host.example.com pine

### 'watch' netstat connections

watch netstat -tn

### Watch the message log

tail -f /var/log/messages

The Tab labels will also change colors every time a new entry is made to the log.

To this point, all our examples have been single shell commands with arguments (though the arguments in some cases are other commands). If we want to combine commands for more complex usage, like piping `ps` to `less`:

/bin/ps ax | less

then it is useful to put these types of commands in a shell script, and then invoke the script from Edit Commands. Much more can be done this way. Alternately, complex commands like the above example can be executed successfully from Edit Commands with the help of `mgt-helper` and the -x option. Example:

mgt-helper -x /bin/ps ax | less

Some other, nicer ideas:

### A Google search

      #!/bin/sh
      txt_browser=w3m

      read -e -p "search google/linux for: " search_str
      [ -z "$search_str" ] && exit
      $txt_browser \
      "http://www.google.com/linux?num=50&restrict=linux&\
      hl=en&lr=lang_en&q=%22$search_str%22&btnG=Google+Search"

This uses the shell `read` command to get user input, which is passed to a text web browser. If the user enters nothing, or after the web browser exits, then the script exits also, effectively closing the Tab. (The google search parameters also include some personal preferences that might be customized as well. The above example is available with `mgt-helper` as `mgt-helper -lg`.)

### Look up a word in a Dictionary

      #!/bin/sh
      txt_browser=w3m

      read -e -p "Look up: " word
      [ -z "$word" ] && exit
      $txt_browser "http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va\
       =$(echo "$word" | sed 's/ /+/')"

This looks up any word in the Merriam-Webster on line dictionary, also using `read` and a text browser, like above. (The above example is available with `mgt-helper` as `mgt-helper -l`.)

### A better netstat watcher

Above we had an example of `watch netstat -tn` that displays a continually self updating display of all our network connections. But `watch` wants to put a clock on the screen, and as it updates the Tab titles alternate from `blue` to `red` every 2 seconds as the screen updates. Very annoying IMO!

So here is a short script to do most of the same thing. It just writes the `netstat` output to a file, and only dumps this file to screen when and if the `netstat` output changes. It also uses some filters to eliminate some things we (errr, I) did not want to be bothered with (e.g. `CLOSE_WAIT` condition, see the `netstat` man page).

      #!/bin/sh
      # display netstat output only if it changes

       tmp_file=/tmp/_netstat
       exclude='127\.0\.0.*127\.0\.0\|_WAIT'
       command="netstat -tn |grep -v \"$exclude\""
       eval $command |tee $tmp_save.sav
       while :; do
         eval $command > $tmp_file.tmp
         ! diff $tmp_file.tmp $tmp_save.sav && clear && cat $tmp_file.tmp |tee $tmp_save.sav
         sleep 2
       done

Now the Tab title will only change color when the connections change, and we are alerted accordingly.

### Starting with a Split Tab

To have &term; start with a split Tab, create a short script like below. Name it something like `add-htab.sh`.

      #!/bin/sh
       multi-gnome-terminal --add-tab --hsplit

Now go into Edit Commands, and add a new startup Tab (from the second tab). Use `add-htab.sh` as the command to open the Tab. Save and apply changes, and make sure Don't open startup tabs is unchecked. Now, when &term; is started, it will be started with a split window. Remember too, you can have different startup command configurations for different classes.

### Having specific `HISTORY` files for Tabs

It would be nice if &term; could save the bash (or other shell) history for each Tab. So when you opened a new Tab, there is only history from your last session in that Tab. But this can be done with a simple shell script quite easily. Create a script like below, and name it something like `bash_wrap.sh`:

      #!/bin/sh

        if [ "$1" == "" ]
        then
         BEXT=""
        else
         BEXT=-$1
        fi

        export HISTFILE=$HOME/.bash_history$BEXT
        exec bash --login

Put this script in your `PATH` somewhere (e.g. `/usr/local/bin/`). Now edit your custom &term; Commands to use the name of this script, instead of just bash, and some unique argument for the script:

      Name          Path            Command
      -------------------------------------------------
      Shell1        None          bash_wrap.sh  myshell1
      Shell2        None          bash_wrap.sh  myshell2
      Shell3        None          bash_wrap.sh  myshell3

What identifier you use for the argument (e.g `myshell1`), is not important, just so it is unique. Now bash will load that history file whenever that Tab is opened. (The above functionality is available with `mgt-helper` as `mgt-helper -h` EXT.)

Maybe you prefer just typing simple commands rather than going through the GUI, or defining a keyboard shortcut? Sometimes this is simpler. Some ideas using bash aliases ...

A simple bash alias to just create a new Tab in the current Window:

      alias m="multi-gnome-terminal  --add-tab"

Now, create a Tab and running the `vim` editor at the same time:

      alias me="multi-gnome-terminal  --add-tab  --tname=Vim  -x vim"

The Tab, of course, closes neatly whenever you exit `vim`.

Now, a open a man page in its own Tab:

      alias mm="multi-gnome-terminal  --add-tab  --tname=Man  -x  /usr/bin/man"

Maybe we want to work in one terminal, and be able to read the man page in the same Window at the same time. So we will do the same here, except just split the current Tab:

      alias mmh="multi-gnome-terminal  --hsplit  -x /usr/bin/man"

Using shell functions, gives even more flexibility:

      mm () {
       args=($@)
       multi-gnome-terminal --add-tab --tname "Man ${args[$(($# - 1))]}" -x /usr/bin/man $*
       unset args
      }

The only real difference between this and the previous bash mm alias, is that the Tab label now shows the name of the man page, instead of just Man (and allows for things like man 5 crontab).

Maybe you have better ideas ;-)

If you have any cool command tricks, please submit to: multignometerm-devel@lists.sourceforge.net.

## Appendix: Screenshots

### Screenshot with Menubar, Toolbar, Buttonbar, and Shadowed Text on Pixmap Background

Screenshot 1

Notice there are four Tabs here, with the second one being the current Tab. This one also shows the Tab label and Window title can be the same with some applications (configurable option).

### Screenshot of Edit Commands Window with various custom Commands

Screenshot 2

Note the Class here is specified as screenshots, and that Class has one custom start-up Tab called Home. The user is in the process of defining a new Tab, that will use `ssh` to start a remote shell on another host.

### Screenshot of Keybindings Window with Default Settings

Screenshot 3

### Screenshot with Toolbar and Buttonbar disabled and with Shadowed Text

Screenshot 4

This also shows how text shadowing helps with text against a similarly colored background.

### Screenshot Showing Horizontal and Vertical Splitting

Screenshot 5

This shows a total of five terminals opened within the same Window using the `HShell` and `VShell` splitting features.

### Horizontal Split with a View Terminal

Screenshot 6

This one shows a horizontal split with a regular user shell in the top, and a View of `tail -f /var/log/messages` running on another host via `ssh` in the lower terminal. Tabs are on the bottom in this shot.

### Screenshot Showing Multiple Mailboxes

Screenshot 7

There are five Tabs in this shot, four of which are different mailboxes. Also, one Tab is just a normal shell. Notice two Tabs are blue, so they are changed since last viewed, and presumably have new mail waiting.

### Screenshot with Most GUI Controls and Window Decorations Off

Screenshot 8

I'll be back!

## Appendix: Resource and Performance Issues

One thing to keep in mind is that featureful GUI programs like &term; use many underlying system components. Things like excessive memory usage, or a keyboard that does not do what we expect, may have the root cause in the underlying libraries and utilities.

Below are some points that might be useful for troubleshooting or optimizing.

### Memory Usage

You can conserve resources by using the New Window feature from the GUI or command line, or the `--use-factory` command line option, when opening new windows, rather than starting a completely new &term; process.

Pixmap and transparent backgrounds will always use more memory than a solid background. A solid background should also be faster, since there is less going on.

Some versions of XFree, and some GTK themes, may not be good about freeing memory, leading to excessive memory usage. Notably, XFree 4.1 (and 4.0?), are known not to release all memory when transparent backgrounds are used. This is not a problem with 3.3.6, and apparently much improved with 4.2. Some themes may have similar problems, or at least aggravate the X memory leak situation. There is nothing that &term; can do to lessen this impact. If you experience unusually high memory consumption that keeps growing, please try a different GTK theme, and, if possible, upgrade to XFree-4.2.

### CPU

&term;'s rich set of features comes with a small price tag. &term; must spend more CPU cycles watching the terminal buffer (even non-visible ones) than other similar applications in order to provide some of these features. On modern, faster systems this should not be noticeable in all but the most unusual of circumstances. The impact of all this may depend on many factors, including your hardware, library versions, and how other system resources are being allocated.

Very fast scrolling or exceptionally busy screens may force &term; into overdrive. This may be more noticeable on low end hardware or during high system load periods. Consider using a non-pixmap, solid background color in such situations. This will help quite a bit. Re-nicing the process can make a difference too. In fact, you can set the shell that is running in the terminal to be re-niced automatically in Edit Commands, and start it automatically when it might be needed. Maybe call it Nice Bash ;-)

## Appendix: NEWS and ChangeLog

- `NEWS` file with all significant &term; changes and bugfixes is: here.

- The `ChangeLog` with the many gory &term; details of changes is: here.