Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
16.  Customizing the Workspace Manager Workspace Manager Menus To Create a New Window Menu  Previous   Contents   Next 
   
 

Customizing Button Bindings

A button binding associates a mouse button operation and possible keyboard modifier key with a window manager function. Button bindings apply to all workspaces.

The desktop default button bindings are defined in the Workspace Manager configuration file in a button binding set named DtButtonBindings:

Buttons DtButtonBindings
 {
   ...
 }

Button Binding Syntax

The syntax for button bindings is:

Buttons ButtonBindingSetName
 {
     [modifier]<button_nameMouse_action>   context  function  [argument]
     [modifier]<button_nameMouse_action>   context  function  [argument]

where:

button_name--Btn1--Left mouse button Btn2--Middle button (3-button mouse) or both buttons (2-button mouse) Btn3--Right button Btn4--Buttons 1 and 2 together on a 3-button mouse Btn5--Buttons 2 and 3 together on a 3-button mouse

modifier--Ctrl, Shift, Alt, Lock

mouse_action--Down--Holding down a mouse; button Up--Releasing a mouse button; Click--Pressing and releasing a mouse button; Click2--Double-clicking a mouse button; Drag--Dragging the mouse while holding down the mouse button

context--indicates where the pointer must be for the binding to be effective. If necessary, separate multiple contents with the "|" character.

root--The workspace window; window--Client window or window frame; frame--Window frame, excluding the contents; icon--Icon; title--Title bar; app--Client window (excluding the frame)

function--one of the window manager functions. Refer to the dtwmrc(4) man page for a list of valid functions.

argument--any window manager function arguments that are required. Refer to the dtwmrc(4) man page for details.

For example, the following line causes the menu described in DtRootMenu to be displayed when mouse button 3 is pressed while the pointer is in the workspace window (but not within client windows).

<Btn3Down>      root     f.menu     DtRootMenu

Note - For complete information on button binding syntax, see the dtwmrc(4) man page.


To Add a Button Binding

  1. Open the appropriate file for editing:

  2. Add the button binding to the DtButtonBindings definition.

    Do not bind the same button to different functions for the click and press operations, and do not bind more than one function to the same button and context.

  3. Choose Restart Workspace Manager from the Workspace menu.

To Create a New Button Binding Set

  1. Open the appropriate file for editing:

  2. Create the new button binding set. See "Button Binding Syntax".

  3. Set the buttonBindings resource to the new name:

    	Dtwm*buttonBindings: ButtonBindingsSetName 
  4. Choose Restart Workspace Manager from the Workspace menu.


    Note - The new button bindings replace your existing button bindings. Copy any button bindings you want to keep from DtButtonBindings.


Customizing Key Bindings

A keyboard binding, also known as a key binding, associates combination of keys with Workspace Manager functions. Key bindings apply to all workspaces.


Note - Be careful about using a common key combination as a keyboard binding. For example, Shift-A normally puts the letter "A" into your current window. If you bind Shift-A to a function, you lose its normal usage.


Default Desktop Key Bindings

The desktop default key bindings are defined in the Workspace Manager configuration file in a key binding set named DtKeyBindings:

Keys DtKeyBindings
 {
  ...
 }

Key Binding Syntax

The syntax for key bindings is:

Keys KeyBindingSetName
 {
    [Modifiers]<Key>key_name   context   function  [argument]
    [Modifiers]<Key>key_name   context   function  [argument]
    ...    
 }

where:

Modifiers--Ctrl, Shift. Alt, and Lock. Multiple modifiers are allowed; separate them with spaces.

key_name--the key to which the function is mapped. For keys with letters or numbers, the key_name name is usually printed on the key. For instance the name of the "a" key is "a", and the "2" key is named "2". The "Tab" key is named "Tab". The "F3" key is named "F3".

For other keys, the name is spelled out--for example, plus for the "+" key. The file keysymdef.h, located in a system-dependent directory, contains additional information about key names.

context--the element that must have the keyboard focus for this action to be effective. These can be concatenated together if the binding applies to more than one context. Multiple contexts are separated by the "|" character.

root--Workspace backdrop; window--Client window; icon--Icon

function--a window manager function. Refer to the dtwmrc(4) man page for a list of valid functions.

argument--any window manager function arguments that are required. Refer to the dtwmrc(4) man page for details.

For example, the following key binding lets the user to switch the keyboard focus to the next transient window in an application by pressing Alt+F6.

Alt<Key>F6     window     f.next_key     transient

Note - For complete information on key binding syntax, see the dtwmrc(4) man page.


 
 
 
  Previous   Contents   Next