DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Configuring window manager key bindings

Configuring key bindings

To modify an existing key binding or to create a new key binding, perform the following steps.

  1. Open the desired window manager configuration file for editing.

  2. Locate the key binding section in the window manager configuration file. The key binding section uses the following syntax:
       Keys  bindings_set_name
       {
           key  context     function
           key  context     function
           key  context     function
                   .
                   .
           key  context     function
       }
    

  3. Configure the key binding specification, if desired.

  4. Configure the function specification, if desired.

  5. Configure the context specification, if desired.

  6. Restart the window manager and test your new key binding.

See also:


Step 1: Editing a window manager configuration file

If you want to make system-wide changes to the default key bindings, open the system-wide window manager configuration file, /usr/lib/X11/system.pmwmrc if you are using pmwm mode or system.mwmrc if you are using mwm mode. The system-wide file contains the default functionality for the window manager key bindings.

If you want to customize the key bindings in your local Graphical Environment, edit your personal window manager configuration file, $HOME/.pmwmrc if you are using pmwm mode or $HOME/.mwmrc if you are using mwm mode. The personal configuration file is not provided with the system by default. If it does not already exist, you must create your own by copying the appropriate system-wide window manager configuration file to .pmwmrc or .mwmrc in your $HOME directory.


NOTE: Once the .pmwmrc or .mwmrc file exists in $HOME, it completely overrides the system-wide window manager configuration file. Therefore, make sure you copy the entire system file to your home directory, to avoid losing critical functionality.

See also:


Step 2: Locating the key binding section

When you locate the appropriate key binding section, you see entries with the following syntax:

   Keys  bindings_set_name
   {
       key  context     function
       key  context     function
               .
               .
   }

Keys
the type of the binding set being defined

bindings_set_name
the name assigned to a set of bindings. The default name is ``DefaultKeyBindings''.

keys
the specification that defines the key press action

context
the specification that defines the window manager context in which the key specification becomes active. For example, a context of a window indicates that the keyboard input focus must be on a client window or a window management frame for the key specification to be effective.

function
the specification that defines one of the many window manager functions or actions. See ``Using window manager functions'' for a list of these functions.

Step 3: Configuring the key binding specification

The window manager configuration files use window manager functions to define the behavior and control the functionality of key events. A key event describes an action that you take, such as pressing the ``r'' key to execute a function (for example: redrawing a window). Key events are single key presses; key releases are ignored. The key event specification has the following syntax:

key  =  [modifier_list]<Key>key_name

where:

modifier_list  =  modifier_name {modifier_name}

Designate any single key for the value in key_name. If you are creating a mnemonic key binding, do not designate a value for modifier_name.

If you are creating an accelerator key binding, make sure your key-action combination is unique by selecting one or more of the values in ``Modifiers'' for the value in modifier_name.


NOTE: The <Alt> key is frequently labeled Extend or Meta. Alt and Meta can be used interchangeably for an event specification.

Modifiers

modifier_name Description
Ctrl Control Key
Shift Shift Key
Alt Alt/Meta Key
Meta Meta/Alt Key
Lock Lock Key
Mod1 Modifier1
Mod2 Modifier2
Mod3 Modifier3
Mod4 Modifier4
Mod5 Modifier5
If you are editing an existing key binding, replace the old key specification with the new one. If you modify any of the default key bindings, make sure you do not remove functionality that you need.

If you are adding a new key binding, put the new key specification on a new line.

Step 4: Configuring the function specification

The syntax for naming a function is the same, no matter what type the function describes. The syntax for naming a function is:

function  =  function_name [function_args]

function_name is one of the valid window manager functions, and function_args is a valid argument to the function. If function_args contains more than one word, the argument must be contained in quotes.

If you are editing an existing key binding, replace the old function specification with the new one.

If you are adding a new key binding, put the new function specification on a new line, after the related key specification.

See also:

Step 5: Configuring the context specification

The syntax for the context specification is:

context  =  app | border | frame | icon | root | title | window

The context specification defines the window manager context in which the key specification becomes active; it indicates where the keyboard input focus must be for the key specification to be effective. For example, a context of a window indicates that the keyboard input focus must be on a client window or a window management frame for the key binding to be effective. The button specification can be active in more than one context.

``Key binding contexts'' lists and describes the values that can be used for context.

Key binding contexts

Context Description
app The key binding is effective when the keyboard input focus is on the application window, not including the window management frame.
border The key binding is effective when the keyboard input focus is on the border of the window management frame, not including the title bar.
frame The key binding is effective when the keyboard input focus is on the window management frame around a client window, border, and title bar.
icon The key binding is effective when the keyboard input focus is on an icon. Note that icon refers to window manager icons only, not Desktop icons.
root The key binding is effective when:

  1. the keyboard input focus is on the Root menu, and

  2. neither a client window nor an icon is to be acted upon by the function.

title The key binding is effective when the keyboard input focus is on the title area of the window frame.
window The key binding is effective when the keyboard input focus is on a client window, title bar, or a window management frame.
If you are editing an existing key binding, replace the old context specification with the new one.

If you are adding a new key binding, put the context specification on a new line, after the related key and function specifications. See ``Function constraints'' and ``Where functions can be used'' for a list of the contexts that are available to each of the window manager functions.

Step 6: Restarting the window manager

After you configure your new key bindings, you must restart the window manager before your changes can take effect. Restart the window manager by selecting the Restart Window Manager option from the Root menu. The Root menu is accessed by pressing and holding mouse button 1 on the Desktop background or, if the Desktop is not running, in the Root window.

Verify that the new key bindings are configured correctly by testing your new key sequences in the appropriate contexts. The key bindings are effective immediately after the window manager is restarted.


Next topic: Creating a new key binding set
Previous topic: About window manager functions

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003