Customizing window manager menus

Example of creating a window manager submenu

This section provides an example that ties together many of the concepts and procedures discussed in this chapter.

Let's assume that you use the SCO Panner window manager in the default pmwm mode. There are several clients that you run frequently and you would like to be able to access these commands from the Root window without having to first run a scoterm window or the Desktop. You can create a menu from which you can launch these commands, and you can make this menu accessible from the Root menu.

The following steps result in a Client submenu that is available from the Root menu:

  1. Open the local pmwm configuration file, .pmwmrc, for editing. This file is located in your home directory.

    If this file does not currently exist, copy the entire system-wide pmwm configuration file, /usr/lib/X11/system.pmwmrc, to your home directory and rename it .pmwmrc.

  2. At the end of the menu section, open a line and begin your new menu definition with the following:

    Menu ClientMenu

  3. Assign your menu a title by entering the following lines:

        "Client Menu" f.title

  4. Create your menu items by entering the following lines:

        "xclock" f.exec "xclock"
        "xload" f.exec "xload"
        "xcalc" f.exec "xcalc"
        "xbiff" f.exec "xbiff"
        "xmag" f.exec "xmag"
        "xeyes" f.exec "xeyes"
        no-label f.separator
        "scoterm" f.exec "scoterm"
        "xterm" f.exec "xterm"

    When you have finished entering the menu items, the entire menu definition should look like this:

       Menu ClientMenu
           "Client Menu"   f.title
           "xclock"        f.exec "xclock"
           "xload"         f.exec "xload"
           "xcalc"         f.exec "xcalc"
           "xbiff"         f.exec "xbiff"
           "xmag"          f.exec "xmag"
           "xeyes"         f.exec "xeyes"
           no-label        f.separator
           "scoterm"       f.exec "scoterm"
           "xterm"         f.exec "xterm"

  5. Now you need to add a menu item for your Client menu to the Root menu definition. Let's add the submenu so it appears after the Refresh option and before the Restart Window Manager option. And let's separate the submenu option from the other options on the Root menu with a dividing line.

    Within the definition section of the Root menu, open a line below the Refresh option and enter the following:

        no-label f.separator
        "Client Menu" ClientMenu

    When you have finished, the Root menu definition section should look like this:

       Menu RootMenu
         @sco-logosm.xbm           f.title
         "Unix Window"             f.exec "/usr/bin/X11/scoterm"
         "Desktop"                 f.exec "/usr/bin/X11/xdt3"
         "Mail"                    f.exec "/usr/bin/X11/scomail"
         "Calendar"                f.exec "/usr/bin/X11/scocal"
         "Screen Lock"             f.exec "/usr/bin/X11/scolock"
         no-label                  f.separator
         "Help on SCO Panner"      f.exec "/usr/bin/X11/scohelp ..."
         "Help"                    f.exec "/usr/bin/X11/scohelp"
         no-label                  f.separator
         "Panner/Icon Menu" "PanMenu"
         "Refresh"                 f.refresh
         no-label                  f.separator
         "Client Menu"    ClientMenu
         no-label                  f.separator
         "Restart Window Manager"  f.restart
         "Quit Window Manager"     f.quit_mwm
         no-label                  f.separator
         "Exit Session"            f.exec "/usr/bin/X11/scosession -stop"

  6. When you have finished writing the definition for your new menu and adding the submenu to the Root menu, save and exit the .pmwmrc file. Make sure you leave the remaining sections of the .pmwmrc file intact.

  7. Access the Root menu and select the Restart Window Manager option. The Root menu is available by pressing and holding mouse button 1 on the Desktop background or, if the Desktop is not running, in the Root window.

    The window manager is restarted; the new menu information in your .pmwmrc file is read, and your new Client submenu is now available from the Root menu.

Previous topic: Step 4: Restarting the window manager

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