HDS ViewStation System Administrator's Guide

A Hypertext Document


Motif Window Manager Root Menu

This page describes the Motif Window Manager root menu. It also includes some suggestions for customizing this menu.

Using the MWM Root Menu
There is another MWM menu which is brought up by pressing the mouse button when the pointer is in the root window. The root menu can be a customized menu you specify in your .mwmrc file, or it can be the ViewStation's default menu.

This default menu has six commands:
HDSperx -- Brings up the HDSperx clients menu
Shuffle Up -- Moves the windows up the stack
Shuffle Down -- Moves the windows down the stack
Refresh -- Refreshes the screen
Restart -- Restarts MWM
Quit -- Exits from MWM

This menu is an easy way to use MWM. It can also be customized to include other options; see the discussion below about changing the menu items.

Customizing the Motif Window Manager
You can choose the way MWM appears on your display by selecting different resources in your .Xdefaults and .mwmrc files; refer to Xrdb Resource Files for more information.

MWM Resource Files
Mwm behavior is controlled by resources. These are usually found in one or more of these files. These are files found in your home directory that MWM reads when it starts up. These files must be present in the ViewStation memory before the local MWM is started or they will not be used.

If you Start the window manager from a remote host (using the rsh command), the ViewStation's window manager will try to read each of these files with the rcp command. These resources are read and loaded into the server memory with the xrdb utility program. You can check the current contents of your resources with the xrdb - query command.

/usr/lib/X11/app-defaults/Mwm
$HOME/Mwm
$HOME/.mwmrc
$HOME/.Xdefaults
$HOME/.Xdefaults-<hostname>


You can place your resource entries in any of these locations, but you should insure that they are read correctly when you start Mwm. This information is available in the log messages in the Console Window.

Some sample resources might be:
! Colors
Mwm*background: LightBlue
Mwm*foreground: Black
Mwm*activeBackground: Blue
Mwm*icon*foreground: DarkSlateBlue
! Fonts
Mwm*fontList: 8x13
Mwm*menu*fontList: 9x15
! Focus Policy
Mwm*keyboardFocusPolicy: pointer
Mwm*focusAutoRaise: true
! Icons
Mwm*useIconBox: true
Mwm*iconBoxGeometry: 2x4


Refer to the Mwm manuals for complete listings of resources and their applicability.

Starting Local Processes from the Local MWM
When you use the ViewStation's local MWM window manager, a submenu for the ViewStation's HDSperx clients is automatically added to your root menu. This submenu lists all the HDSperx clients you have loaded (by means of the Clients.config File) and you can start them simply by clicking on them. The details of making changes to this menu and setting it up manually are given later in this Section.

Starting Remote Processes from the Local MWM
The ViewStation runs mwm locally on the server. Either window manager may be started from a remote host using the rsh (BSD Unix) or rcmd (System V Unix) command. Starting processes on other hosts is done in the same way as with a remote window manager, that is, using using remote shell commands specified in the appropriate configuration file. The sample configuration file for the window manager menus below shows the process. This file resides in the user's home directory.

MWM Menu with HDSperx
Mwm provides an f.exec function to permit the user to start an X client or other process from a menu selection as specified in a configuration file, such as .mwmrc.

Details of operation for MWM and this file are available with the OSF MWM specification, including matters of labeling and syntax.

There are two things to note:
1) You must start the ViewStation local window manager from a remote host in order to use these resource specifications and menu entries for the local window manager. This remote host and this user will be the host and the user for starting remote processes, so the appropriate permissions and accounts must exist. If you start the ViewStation's local window manager from the Setup Mode menu, none of these commands will work because only the default resources are used. An error message "No remote host running" will appear in this case. The usage of these files is the same as when a host-based window manager is used. Refer to Starting the Window Manager with RSH a more complete discussion of starting from a remote host.

Further, the permissions for the ViewStation must be the same as for the remote host that started the local window manager. This means that a process valid for the host will also be permitted for the ViewStation. This permission is set in the / etc/hosts.equiv file, where you must enter the ViewStation's name as an equivalent to the host.

2) The local window manager reads (for purposes of its internal rcmd function) the environment files for the user specified, so the environment settings appropriate for the process must be present in the user's .cshrc file. For Bourne and Korn shells, the corresponding files are .profile, though you should double-check that these files are always read when the new shell is spawned. All commands to the remote host are prepended with the ViewStation's display setting so the output is returned to the ViewStation.

If you have problems starting remote processes, look in the Console Window for error messages and use the checklist Remote Starting Checklist. You may see messages that report the rhosts command failed because of incorrect permissions, or a file was not found, or that a host is not reachable. Your host machine must be configured with permission for the ViewStation to start remote processes; refer to your /etc/hosts.equiv file for a ViewStation entry.

Editing the Root Menu Description
You can customize the MWM menus to include things that you do frequently. This is usually done in the .mwmrc file, which is located in your home directory and is read when MWM starts up. A sample .mwmrc file for the HDS local MWM is included at the end of this chapter.

The default menu for the RootMenu is shown below:

Menu RootMenu

{
"Root Menu"		f.title
"Shuffle Up"		f.circle_up
"Shuffle Down"		f.circle_down
"Refresh"		f.refresh
no-label		f.separator
"Restart..."		f.restart
no-label		f.separator
"Quit..."		f.quit_mwm
}

Note that the HDSperx entry is added automatically to the top of this menu. It is not included as part of this menu since it is added by the MWM "autoClient Menu" resource.

If you want to customize this menu, you can simply add a few lines with your text editor. This is a convenient place for commands you use frequently, but you should think carefully about how you will use it. Note that there are system considerations involved with your choosing commands that start other processes. Circulating windows up and down is a local function handled by the window manager. Starting a new client on a remote host involves many more considerations, such as authentication privileges, identifying the display, and so on.

Sample Customized Mwm Root Menu
This example is an .mwmrc file with a fairly complicated menu, including a num ber of submenus and button bindings, etc. It is intended to give you samples of possible entries for your own files.

#
# Root Menu Description

Menu RootMenu
{
 "Root Menu" 		f.title
 "Local XTerms" 	f.menu "LocalWindowsMenu"
 "Remote Windows" 	f.menu "RemoteWindowsMenu"
 "Applications" 	f.menu "ApplicationsMenu"
 no-label 		f.separator
 "Lock" 		f.exec "hdslocal hdssaver -lock -password TV342 -
nographics&"
 no-label 		f.separator
 "Shuffle Up" 		f.circle_up
 "Shuffle Down" 	f.circle_down
 "Refresh" 		f.refresh
 no-label 		f.separator
 "Restart..." 		f.restart
 no-label 		f.separator
 "Quit Mwm..." 		f.quit_mwm
}
Menu LocalWindowsMenu
{
 "Local XTerms" 	f.title
 "HDS Memory" 		f.exec "hdslocal hdsmemory &"
 "SlateBlue" 		f.exec "xterm -fg white -bg slateblue &"
 "IndianRed" 		f.exec "xterm -fg white -bg indianred &"
}

Menu RemoteWindowsMenu
{
"Remote Windows" 	f.title
"HDS486 Window" 	f.exec "rcmd hds486 scoterm"
"HDSsun6 Window" 	f.exec "hdslocal hdsterm -bg cyan -e rlogin 
hdssun6 &"
"HDSsun5 Window" 	f.exec "hdslocal hdsterm -bg lemon -e rlogin 
hdssun5 &"
"HDSsun9 Window" 	f.exec "hdslocal hdsterm -bg thistle -e rlogin 
hdssun9 &"
}

Menu ApplicationsMenu
{
"Applications" 		f.title
"HexCalc" 		f.exec "hexcalc &"
"Mail" 			f.exec "xmail -iconic &"
"News" 			f.exec "xrn -iconic &"
"Clock" 		f.exec "xclock -bg thistle &"
"Performance Meter" 	f.exec "perfmeter &"
"File Manager" 		f.exec "filemgr &"
"Local Xclock" 		f.exec "hdslocal hdsxclock -bg cyan &"
"HDS PS View"		f.exec "hdslocal hdsview &"
}

# Window Menu Description

Menu WindowMenu
{
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
Maximize 	_x 	Alt<key>F10 		f.maximize
Lower 		_L 	Alt<key>F3 		f.lower
no-label 					f.separator
Close 		_C 	Alt<key>F4 		f.kill
}
#
# key binding descriptions
#

Keys DefaultKeyBindings
{
Shift<key>Escape 	window|icon 			f.post_wmenu
Meta<key>space 		window|icon 			f.post_wmenu
Meta<key>Tab 		root|icon|window 		f.next_key
Meta Shift<key>Tab 	root|icon|window 		f.prev_key
Meta<key>Escape 	root|icon|window 		f.next_key
Meta Shift<key>Escape 	root|icon|window 		f.prev_key
Meta<key>Pause 		root|icon|window 		f.exec "hdslocal rehash"
Meta<key>PgUp		root|icon|window		f.exec "hdslocal xset fp rehash"
Meta Shift Ctrl<key>exclam 	root|icon|window 	f.set_behavior
Meta<key>F6 		window 				f.next_key transient
Meta Shift<key>F6 	window 				f.prev_key transient
<key>F4 		icon 				f.post_wmenu
}

#
# button binding descriptions
#

Buttons DefaultButtonBindings
{
<Btn1Down> 		frame 		f.raise
<Btn1Down> 		icon 		f.normalize
<Btn3Down> 		icon 		f.post_wmenu

f.menu RootMenu
}

Buttons ExplicitButtonBindings
{
<Btn1Down> 		frame 			f.raise
<Btn1Down> 		icon 			f.normalize
<Btn3Down> 		frame|icon 		f.post_wmenu
<Btn3Down> 		root 			f.menu RootMenu
Shift<Btn1Down> 	window|icon 		f.lower
Shift<Btn2Down> 	window|icon 		f.resize
Shift<Btn3Down> 	window|icon 		f.move
Meta<Btn1Down> 		window|icon 		f.lower
Meta<Btn2Down> 		window|icon 		f.resize
Meta<Btn3Down> 		window|icon 		f.move
}

Buttons PointerButtonBindings
{
<Btn1Down> 		frame 			f.raise
<Btn1Down> 		icon 			f.normalize
<Btn1Down> 		root 			f.menu RootMenu
<Btn1Down> 		window 			f.raise
<Btn3Down> 		frame|icon 		f.post_wmenu
Shift<Btn1Down> 	window|icon 		f.lower
Shift<Btn2Down> 	window|icon 		f.resize
Shift<Btn3Down> 	window|icon 		f.move
Meta<Btn1Down> 		window|icon 		f.lower
}
#
# END OF mwm RESOURCE DESCRIPTION FILE
#

There are a number of things to notice in this file.
1. Look at the file syntax. Note the { and } to separate sections of the file. Note the use of white space and tabs. It's easiest just to copy an example like this, but be careful as you do it. It is good practice to copy the original working file under another name while you experiment with your changes.

2. Look at the way the menus and submenus are named and designated within each other.

3. Note that the HDSperx submenu is not listed here. It is added automatically as the first item on this root menu by the merging mechanism when the ViewStation's MWM starts, if it is started with the remote shell process. This is discussed in more detail below.

4. Look at the way "no-label"/"f.separator" entries are used to provide visual organization to the menus.

5. Look at the way the Motif functions are labeled, with f.menu designating a menu, f.exec designating command line execution, as well as special Motif functions like f.restart, and so on.

6. The f.exec entries for ViewStation local clients use the "hdslocal" as an indicator that the process is a local ViewStation process, and also as a ViewStation command to select the local client. Optionally, you could have a script on your host computer called "hdslocal" that would kick off ViewStation clients (using the "rsh" command line) if you were using the host's MWM. This would insure that the menu entries were executed correctly regardless of the MWM's location, host or ViewStation.

7. The "Lock" entry on the Root Menu gives a quick and easy way to lock your screen with ViewStation's local screen lock. The password (TV342 in this case) entered on this line is the password to unlock the screen. You could protect the .mwmrc file to maintain security for this password.

8. Note the use of "rlogin" for the RemoteWindowsMenu. This opens a new window without the need to login (based on correct passwords and permissions on your network). Different color backgrounds are given to distinguish the HDSterm windows (you could also use Title bar names).

9. Note the "WindowMenu" entry. This is the menu for the Motif button on the upper left of the title bar. The letters in the second column are accelerators. Do not modify this menu.

When you make changes to this menu, do them one at a time and make sure they work. Check your command lines for f.exec entries manually to make sure they do what you want before you add them to the menu.

Starting Clients with Mwm
There are many places to start clients and control their resources. Consider these other locations for configuration selections.

Setup Mode - The ViewStation has many configuration settings built into Setup Mode, such as the ability to load individual colormaps, or a configuration file of NVM settings, fontpaths, etc.

Xdm - Xdm is the display manager and is usually the best place to open clients, remote shells, clients you open when you start (like xclock or xload), and xrdb.

Xrdb - this is a utility to read your .Xdefaults file from some location or from your home directory. Any Mwm* resources in this file would be given to MWM when it started up.

Individual .rc files - MWM has its own .rc file, called .mwmrc, usually found in your home directory. Comparable files for other clients are app-defaults files (such as /usr/lib/X11/app-defaults/xterm) which are usually located in the / usr/lib/X11/app-defaults directory.

An example of the kind of problem you might encounter with conflicting settings or definitions of this type is with key assignments (bindings) for different clients. In the X world, the xmodmap utility is used to remap the keyboard, but this is a global setting and will apply to all clients and all windows. This is the correct place for some key preferences, such as multinational keyboards with swapped letters, or setting the mouse buttons for left-handed users. The window manager (like MWM) also sets some key bindings which have an almost global application; for instance, the Shift-Esc key sequence brings up the MWM Default Window Menu in the active window regardless of the location of the mouse pointer. Other windows, such as xterms, might have their own key and mouse bindings for particular functions. These might conflict with one another if you are not careful of your definitions.

You should always be sure that these resources, from whatever source, are loaded before the client starts.

Return to Section Heading Page


Return to the Home Page

If you need more information than is available here, you can reach HDS via email at info@hds.com, or call us at 1.800.HDS.1551 in the USA, or at +610.277.8300 from outside the US. For questions or problems regarding the HDS WWW page, contact webmaster@hds.com.
© 1996 by HDS Network Systems Inc.