[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 User's Guide



Keyboard Bindings

In a manner similar to mouse button bindings, you can bind window manager functions to keys on the keyboard by using keyboard bindings.

Default Keyboard Bindings

Motif has default key bindings. These key bindings are replaced with user-specified key bindings specified with the keyBindings resource. Table 6-6 lists the default key binding specifications.

Table 27. Default Keyboard Bindings

Keys Context Function
Shift<Key>Escape window| icon f.post_wmenu
Alt<Key>space window| icon f.post_wmenu
Alt<Key>Tab root| icon| window f.next_key
Alt Shift<Key>Tab root| icon| window f.prev_key
Alt<Key>Escape root| icon| window f.circle_down
Alt Shift<Key>Escape root| icon| window f.circle_up
Alt Shift Ctrl<Key>exclam root| icon| window f.set_behavior
Alt<Key>F6 window f.next_key transient
Alt Shift<Key>F6 window f.prev_key transient
Shift<Key>F10 icon f.post_wmenu

Keyboard Binding Syntax

The syntax for keyboard bindings is as follows:

Keys 
 
KeyBindingSetName
 
{
 
 
 
key context [| 
 
context] 
 
function [
 
argument]
 
 
 
key context [| 
 
context] 
 
function [
 
argument]
 
 
 
 
key context [| 
 
context] 
 
function [
 
argument]
 
}

Each line identifies a unique key press sequence, followed by the context in which that sequence is valid, followed by the function to be done. Some functions require an argument. Context refers to the location of the keyboard input focus when a key is pressed.

Modifying Keyboard Bindings

To modify the default keyboard bindings, you need to edit either system.mwmrc to make system-wide changes or .mwmrc to make changes to the local environment. The easiest way to modify keyboard bindings is to change the default bindings or to insert extra lines in the DefaultKeyBindings.

When modifying a keyboard binding, you need to decide which key you want to bind and which action the key performs. Then choose the context in which the key binding is to work (see Table 6-7).


Table 28. Contexts for Key Bindings

Use this context... When the keyboard focus is here...
root Workspace (root window)
window Client window (includes frame, title, border, and application window)
icon Icon

Note that if f.post_wmenu or f.menu is bound to a key, mwm automatically uses the same key for removing the menu from the screen after it has been popped up.

Suppose you wanted to eliminate a particular keyboard binding. To disable it, you can delete or comment out the appropriate line in your .mwmrc file. You comment out a line by placing an ! (exclamation point) comment character at the beginning of the line. The following shows an example of a commented-out line in a .mwmrc file:

Keys  DefaultKeyBindings
 
{
 
!Shift<Key>Escape    icon|window     f.post_wmenu
 
Alt<Key>Tab      window          f.next_key
 
}

Making a New Keyboard Binding Set

With keyboard bindings, as with button bindings, you have the option of creating a whole new binding set. To do so, use the DefaultKeyBindings of your .mwmrc file as a model. After you have created the new keyboard binding set, use the keyBindings resource to specify a key binding set in your .Xdefaults file:

mwm*keyBindings: 
 
NewKeyboardBindingSetName

The default value for this resource is DefaultKeyBindings.


[ Previous | Next | Contents | Glossary | Home | Search ]