Customizing window manager menus

Changing the menu associated with the window menu button

You can use the window manager windowMenu resource to change the menu that appears when the user clicks on the window menu button. This allows you to display a menu of your choice from the window menu button without having to extensively remodel the default Window menu.

To associate a new menu with the window menu button, create the new menu, as described in ``Adding or modifying window manager menus'', and then perform the following steps.

  1. Open the desired resource file for editing.

  2. Add the Window menu resource specification, using the following format:

    Pmwm*windowMenu: menu_name


    Mwm*windowMenu: menu_name

  3. If desired, you can further customize the Window menu with the following resources: When you have finished, save your changes and exit the resource file.

  4. Restart the window manager.

Step 1: Editing the resource file

You can change the default Window menu so that all users on your system access the new menu, or you can change the Window menu for an individual user.

The majority of window manager resource settings are defined in the /usr/lib/X11/app-defaults/Pmwm (for pmwm mode) or the /usr/lib/X11/app-defaults/Mwm (for mwm mode) resource file. The resources in this file are read by the resource manager when the window manager is executed. If you want to define the new windowMenu resource for all users on your system, you should edit this file. You must have root privileges to perform this step.

Individual users can also change the Window menu that is displayed. Individual resource settings are placed in a file called .Xdefaults-hostname, where hostname is the name of the host, or machine, where the window manager is running.

NOTE: The .Xdefaults-hostname file does not exist in the user's home directory by default. If this file is not present, you must create it before you can specify a different Window menu.

If you create this file for a user from the root account, you must assign the file the correct ownership permissions. Run the chown command to assign the correct owner and the chgrp command to assign the correct group to the .Xdefaults-hostname file. If you created this file yourself, these steps are unnecessary.

When the user invokes a client, it checks to see if an .Xdefaults-hostname file exists in $HOME. If such a file does exist, the resource values specified in the user resource file take precedence over any values assigned to the same resource for the system, or in the resource database.

See also:

Step 2: Setting the windowMenu resource

Use the window manager windowMenu resource to specify the menu that you would like to use instead of the default Window menu. Note that it is unlikely that this resource is actually defined in any of the window manager resource files on your system. The default value of the windowMenu resource is the name of the built-in Window menu specification, ``DefaultWindowMenu''.

Use the following format to set this resource:

Pmwm*windowMenu: menu_name


Mwm*windowMenu: menu_name

menu_name is the name you assigned your menu in the menu definition section of the window manager configuration file (/usr/lib/X11/system.pmwmrc and $HOME/.pmwmrc for pmwm mode or /usr/lib/X11/system.mwmrc and $HOME/.mwmrc for mwm mode).

For example, if you created a menu that you defined as ``MyMenu,'' and you want to use this menu in place of the default Window menu, set the windowMenu resource so it reads:

Pmwm*windowMenu: MyMenu


Mwm*windowMenu: MyMenu

Window menus can also be assigned on a client class basis. This means that the menu you specify is used as the Window menu for the designated client(s) only, and the default Window menu is used for all other clients. To do this, use the following format:

Pmwm*client*windowMenu: menu_name


Mwm*client*windowMenu: menu_name

client can be specified using either the application's binary or class name. menu_name is the name you assigned the menu in the menu definition section of the window manager configuration file.

For example, suppose you want to configure a particular menu of your own creation, defined as ``EditorMenu'' in the window manager configuration file. To have it function as the Window menu only in a scoedit graphical editor window, specify the following:

Pmwm*ScoEdit*windowMenu: EditorMenu


Mwm*ScoEdit*windowMenu: EditorMenu

Step 3: Modifying other Window menu resources

There are two other resources that you can set to customize the Window menu. These resources can be set on their own, or in conjunction with assigning a custom menu to the window menu button.

Step 4: Restarting the window manager

After you have specified the new window manager resource values, you must restart the window manager so 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 your new menu is now being used as the Window menu.

Next topic: Example of creating a window manager submenu
Previous topic: Step 5: Restarting the window manager

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