DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Customizing window manager menus

Adding or modifying window manager menus

You can create completely new window manager menus that you can call to the screen by pressing a mouse button or a key on the keyboard, or by selecting it from an existing menu. You can also modify the existing window manager menus (the Root and Window menus) to include additional menu items or submenus.

To create a new window manager menu, perform the following steps.

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

  2. Within the section of the configuration file that contains menu definitions, begin the new menu with the section type and section title, using the following syntax:

    Menu menu_name

  3. Enter your menu items, using the following syntax:

    {
        label   [mnemonic]   [accelerator]   function
        label   [mnemonic]   [accelerator]   function
        .
        .
        label   [mnemonic]   [accelerator]   function
    }

  4. Define the method by which you want to access the new menu:

    When you have finished, save and exit the configuration file.

  5. Restart the window manager.
You can also add new menu items to the existing Window and Root menus by following these steps. In particular, pay attention to Step 1 and Step 3. If you are modifying existing window manager menus. Step 4 is unnecessary.

Step 1: Editing a window manager configuration file

The default operation of the window manager is largely controlled by a system-wide file, called system.pmwmrc if you are using pmwm mode or system.mwmrc if you are using mwm mode. This file's functions include defining the contents of the Root and Window menus and how menu functions are invoked. Individual users can also have a version of this file, located in their home directories, called .pmwmrc (for pmwm mode) or .mwmrc (for mwm mode). This file can be used to customize window manager menus for an individual user without affecting other users on the system.

Open one of the following files for editing:

See also:

Step 2: Starting a new menu

The first section of the window manager configuration file defines the contents of the Root and Window menus. If you want to create a new widow manager menu, add the menu definition to the end of this section.

A menu definition starts with the Menu section type and a title for the section, designated by the menu_name specification:

Menu menu_name

The menu_name specification is an internal reference and does not appear as the title of the menu. The string value that you assign to menu_name is often referenced elsewhere in the window manager configuration file. In particular, menu_name can be paired with a button action (in the button bindings section of the configuration file) so you can press a particular mouse button to display the menu. This concept is covered in greater detail in Step 4.


NOTE: The menu_name can also be used as the value for the rootMenu and the windowMenu resources. See ``Changing the menu associated with the window menu button'' and ``OSF/Motif window manager resources'' for more information on specifying these resources.

The following example shows the section type and title for the default Root menu:

   Menu RootMenu

Step 3: Creating menu items

The syntax for defining items on a window manager menu is very simple. Each item is defined by a line that uses the following format:

{
label [mnemonic] [accelerator] function
}

The syntax for items on the Root menu is slightly different because mnemonics and accelerators are not available.

When creating menu options, note the following:

The following example shows how the label, mnemonic, accelerator, and function clauses are defined for all of the items on the Window menu that is used by default for pmwm mode:
   "Restore"       _R   Alt<key>F5         f.normalize
   "Move"          _M   Alt<key>F7         f.move
   "Size"          _S   Alt<key>F8         f.resize
   "Minimize"      _n   Alt<key>F9         f.minimize
   "Lower"         _L   Alt<key>F3         f.lower
   "Raise"         _a   Alt Shift<key>F3   f.raise
   "Toggle Nail"   _a   Alt Shift<key>F2   f.nail
   "Hide"                                  f.hide_panner


NOTE: Menu options are grayed if an entry performs the f.nop function, an invalid function, or a function that is not available in the current context.

Step 4: Specifying how to access the new menu

Before you can use your new menu, you must specify the method by which it can be accessed. You can attach the menu to an existing menu so it is available as a ``cascading'' or submenu. You can also configure the menu so a mouse button or key event displays the menu. These approaches are discussed here. You can also replace the default Window menu with your new menu, so it is automatically available by clicking on the window menu button. This approach is discussed in ``Changing the menu associated with the window menu button''.

When you have finished specifying how you can access your new menu, save and exit the window manager configuration file.

Step 5: Restarting the window manager

After you have added your new menu information to either the local window manager configuration file ($HOME/.pmwmrc or $HOME/.mwmrc) or the system-wide file (/usr/lib/X11/system.pmwmrc or system.mwmrc), you must restart the window manager before your changes can take effect and your new menu can be displayed.

Restart the window manager by selecting the Restart Window Manager option on the Root menu. The Root menu is accessed by pressing and holding mouse button 1 anywhere on the Desktop background or, if the Desktop is not running, in the Root window. After the window manager restarts, you can use your new menu.


Next topic: Changing the menu associated with the window menu button
Previous topic: About window manager menus

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 26 May 2005