[ back to User's Guide Table of Contents ]

Window Management with X Windows or HP CDE


On the DEC and HP workstations, you will want to run a window system and a window manager. A window manager operates on top of a windowing system. For example, X Windows is a window system. Twm, mwm, and CDE are window managers. CDE is based on the Motif Window Manager and hence very similar to it. CDE is the default interface on our versions of the DEC UNIX, HP-UX and Solaris x86 operating systems. X Windows is free software that runs on all those operating systems as well as on others, such as Linux. Please note that X Windows, CDE, twm and mwm are highly customizable, so the set-up may not always remain the same through system upgrades, from one user account to another, etc.

X Windows and CDE both let you divide your workstation's screen into one or more "windows". You enter information into a window by moving a "mouse cursor" into that window and typing on the keyboard. Each window acts like a separate terminal, and you can do different things in each one. You can edit a file in one window, format a document in another, compile a program in another, view your mail messages in still another, and so on.

X Windows and CDE both make the workstation a very powerful tool. After you create the windows you want to use, you can move them around and shuffle them above or beneath one another, making them any size you want. You can also remove individual windows from your screen as you are done with them. You manipulate windows using the mouse, commands entered from your keyboard, or a combination of the two.

Of Mice and Windows

The mouse  is an auxiliary input device that is attached to your workstation with a flexible cord. It is about the size of a hockey puck and has three buttons. You'll use the mouse to control the mouse cursor  on your workstation screen.

When the mouse cursor in inside most windows, it is shaped like a capital I or an arrow, and when it is over the background screen (the area outside any window), it is shaped like a capital X. When the mouse cursor is over the background screen (also called the root window), typing on the keyboard has no effect.

You'll learn to perform three basic functions with the mouse: pointing, clicking, and dragging. Pointing  is simply moving the mouse to put the mouse cursor in the desired location. Clicking  is quickly pressing and immediately releasing one of the mouse buttons. Dragging  is holding down a mouse button, moving the mouse, then releasing the mouse button.

X Windows

Opening Additional Windows

As you become more adept at using X Windows and other UNIX software and services, you may find it more convenient to work with multiple windows.  There are two easy ways to open additional windows.


Creating a Window Using the "Root Menu"

Move the mouse cursor onto the background screen (the cursor will change shape to resemble a capital X) and press the left mouse button. This displays the "Root Menu".  While holding down the left mouse button, move the mouse cursor (which is now shaped like an arrow pointing diagonally toward the upper right) downward until a box appears around the first selection on the menu. Release the mouse button. Another window, labeled xterm in the title bar will appear following a brief pause. Other windowing systems often refer to the title bar as the banner.

The mouse will move to the new window after it opens. If you want this new window to be located in a different position on the screen, move the mouse until the mouse cursor is in the xterm title bar (the rectangle containing the words xterm ), press down the left button, and while holding the button down, drag the window to a new location on the screen.


Creating a Window with xterm

The xterm program also lets you create an additional window on your screen into which you can type commands and retrieve information.

To create a new window using xterm, enter at the prompt:

The system will respond with [1] xxx, where xxx is a number, followed by the % prompt. Another window will then open and the word xterm will appear in the title bar of the newly opened window. If you get an error like the following:

Error: Can't open display:

make sure your DISPLAY environment variable is set properly. To set the DISPLAY, type:

% setenv DISPLAY hostname:0.0

where hostname is the name of the machine you are using, for example,

% setenv DISPLAY lacerta:0.0

If you get a message saying "Command not found.", make sure that you have /usr/bin/X11 and /usr/sww/X11/bin in your path. If you get a message like the following:

[1] + Stopped (tty output) xterm

Type "fg" to bring the xterm process to the foreground and see more text about the error. You'll then need to fix whatever caused the error before starting up an xterm.

Don't forget to enter & after term. Using & causes the xterm program to run in parallel with the first window as a concurrent process. If you don't type the &, you won't be able to work in your original window, because xterm will be running in it. The [1] means that this is your first background process and the xxx is its Process Identification number (or PID).

After you type xterm &, the mouse will move to the new window after it opens. If you want this new window to be located in a different position on the screen, move the mouse until the mouse cursor is in the xterm bar (the rectangle containing the word xterm), press down the left button, and while holding the button down, drag the window to a new location on the screen.

If you open additional windows using xterm versus using the "Root Menu", you may notice error messages as you close these windows. The following message will appear: xterm: fatal IO error 32 (Broken pipe) or KillClient on X server " nodename .berkeley.edu:0.0" where nodename is the name of your workstation. The % prompt will not reappear until you press [RETURN]. You may avoid these messages by using the"Root Menu" method of opening windows.


Customizing Your Windows

You may customize any window by changing the size, position, font type, etc. To do this, just add some command line options to your xterm command, for example:

% xterm -T my_title -rv

will create an xterm window with the title "my_title" and in reverse video. Type man xterm from the % prompt for more details.

You can also put customizations in a .twmrc or .Xdefaults file in your home directory. This is a bit more complicated, and if you make any mistakes you may not be able to log back in to your account. You can customize just about everything. For example, here is my .Xdefaults file:

XTerm*scrollBar:        true
XTerm*font:             -adobe-courier-*-r-*-*-0-140-*-*-*-*-*-*
#XTterm*Font:           9x15
XTterm*Geometry:        80x55
xterm*fontList:         -adobe-courier-*-r-*-*-0-140-*-*-*-*-*-*
#ifdef COLOR
xterm*background:       azure1

It is recommended that you get a book on X Windows if you intend to customize to this extent.


Getting Rid of a Window

To get rid of an xterm window, move the mouse cursor into the window to be closed and type exit then press Return. This kills the xterm process and makes the window disappear. You may also close a window by placing the mouse cursor in the small box in the upper left-hand corner and double clicking the left mouse button.

You do not have to close all of the windows that you've created before you logout, although it is advisable to do so. Your final logout process will get rid of all open windows and the processes associated with those windows.

Remember, shutting down all of your windows does not always log you off the machine. To logoff,  you must exit completely from the machine. On the Sun and SGI workstations, hold down the right mouse button and select the last menu item. A good rule of thumb when logging off from an X Windows session is to make sure you see the login: prompt on the screen before you leave. That way you know you are logged off completely.


The Window Manager

There are several ways to issue most window manager commands.   You can use the mouse in conjunction with the location of the mouse pointer on the screen; you can use the mouse in conjunction with the [META] and [CTRL] keys ([META] is labeled Compose Character  , Esc  , or Alt   depending upon your keyboard ); or you can choose commands from a pull-down menu.

You issue commands from the mouse with various mouse button pointing, clicking and dragging combinations. Table 9.1 summarizes the different ways to execute commands with twm using the mouse and keys.

	-----------	---------------------------------------
	Action		Method
	Move		Title Bar-LEFT-Drag
	Iconify		RightCorner-smallbox-LEFT-Click
	Deiconify	Icon-LEFT-Click
	Shuffle Up	Title Bar-LEFT-Click
	Menu		Root Window + Any Mouse Button
	-----------	---------------------------------------

	Table 9.1  twm Window Manager Commands


Move a Window

When you execute this command and click on a window, that window will be outlined. While holding the mouse button down, move the mouse. Once you have your window located where you want it, release the mouse button and your window will reappear in its new location.


Iconify a Window

When you iconify a window, you replace it with a small symbol that represents a window (an icon). The icon "remembers" the size and location of that window, so when you restore the iconified window, it will appear in its old location. You should iconify windows if there are too many windows for you to see easily.

When you execute the iconify command, your active window will disappear and its icon will appear in its place. You can move icons the same way you move windows, so you can create your own method for organizing your workspace.




Login Options

Before you login to one of the Hewlett Packard workstations, you should see a login banner with several buttons at the bottom of the screen. To get help with logging in, click the left mouse button on HELP.

Press and drag the left mouse button on Options to see the menu of options. The following table shows the most useful options:

		HP VUE Login Options

Option 			Purpose
---------------------	----------------------------------------------------
Restart server		This will restart the window system.  This is useful
			if the login banner is messed up. 
No Windows		Login with no window system at all.  This is usually
			not necessary. 
Fail-Safe session	Force a login session, even if there are errors in
			your .vueprofile, .vuewmrc or other startup files.
			This option is very useful for debugging your startup 
Lite Session		Use a "Lite" version of CDE.  This is similar to CDE, 
			but has less functionality and is less of a drain on 
			the computer.

			If you select CDE Lite, you will continue to get 
			"Lite" every time you login unless you specifically 
			change it back or don't run CDE at all.
---------------------	----------------------------------------------------

The Basics

Most of the information in the previous section on X Windows also applies to CDE, but there are some differences that will be covered here.

When you first login (assuming you haven't selected any different options from the Options menu), you should see one dtterm window (basically like an "xterm" window), a file manager window and a control panel along the bottom of the screen. (You may be prompted for your terminal type in the dtterm window; if so, move the mouse cursor to that window, click the left mouse button, and type "dtterm".)  

The file manager   is similar to the Apple Macintosh interface which shows an icon for each file or directory in your current directory.

The control panel   provides quick access to many applications and accessories. To select something from the control panel, click the icon with the left mouse button. There will be documentation in the HP lab with more details about the items available on the control panel. It's best to just experiment with these tools by clicking on the icons.

Opening Additional Windows

To open up another window, click the left mouse button on the terminal icon at the lower left side of the control panel. If you aren't sure which icon this is, ask a neighbor, or see the signs that should be posted in the lab.

Also, see the information in Creating a Window Using the "Root Menu".

Depending upon the configuration of your window manager, you may need to move the mouse pointer to the particular window you would like to use and click the left mouse button in order to use another window.


How to Logout from CDE

To exit CDE, i.e., logout from the workstation, click the left mouse button on the Exit icon on the lower right side of the control panel. You will then be prompted to confirm this by clicking on the OK button.

You can also move the mouse cursor onto the background screen (the cursor will change shape to resemble a capital X) and press the right mouse button. Select Logout... from the menu, then confirm this by clicking on the OK button.

It's a good idea to always wait until you see the login banner reappear on the screen to be sure you are properly logged out. If the login banner does not reappear, you can hold down the three keys [SHIFT] [CTRL] [RESET] at the same time. This will log you out and restart the window manager. If you don't logout properly, your account is not secure.


Starting X Windows instead of CDE

The .dtprofile file in your home directory controls what window manager is run after CDE starts up. Generally, you will automatically get the CDE environment unless you specify otherwise. CDE ignores your .xsession file by default. To get the X Windows "xdm" manager (which will then read your .xsession file), enter this line at the bottom of your .dtprofile file: The .xsesssion file will be execute next time you login on a workstation. Note that the .xsession file is a program, and so it must be executable by you ("chmod ugo+rx .xsession") and have proper code in it. The default .xsession file for new EECS Instuctional accounts is in /share/b/default-named-account/.xsession.

Problems with CDE

If you have problems logging in to the HP workstation, select the Options button, then select Restart Server. This will restart the CDE server.

If the workstation is up and running but there is no login banner, type CNTL-D a few times. The CDE server should then restart. If it doesn't, there may be another problem. Please report this by sending e-mail to inst@eecs.berkeley.edu.

If you aren't sure what's wrong with the display, type [SHIFT] [CTRL] [RESET]. This will logout any active console processes and restart the CDE server. This will not affect any users who are logged in remotely.

If you edited the .dtprofile file in your home directory and are now unable to login, select the Options button, then select Fail-Safe Session. This will allow you to login and fix any problems in your .dtprofile.