© 2008 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.

U014a - More About X Windows

   

U-014a, MORE ABOUT X WINDOWS



CONTENTS


INTRODUCTION

The X Window System was developed by researchers at the Massachusetts Institute of Technology in cooperation with several computer workstation vendors to provide a windowing tool that would be portable across different computers and display architectures, and across different operating systems. This document will focus on the X Window System user interface supported by Information Technology and Communication (ITC) on Sun and RS/6000 workstations. The X Window System may be referred to as "X Windows" or "X" in the text. The name X came naturally since its predecessor was called W (much as the C programming language followed one called B). The current release publicly available from the X consortium is X11R6. As of the summer of 1994, this release was still insufficiently stable, and much software remained to be developed for Release 6. Therefore, ITC still supports Release 5.

Document U-014, "Introduction to the X Window System," discusses the concepts of window systems, the workstation as a multi-user environment, and an explanation of the client/server model. Instructions for running X applications from remote machines are given in detail. Please refer to that document for an introduction to the windowing system. Numerous applications that may be run from the user-defined menus are also briefly described there to help the novice user begin to enjoy the windowing environment.

This document is designed for the X Window System users who want to customize the "look and feel" of their workstations. We examine the various startup files in detail, giving particular attention to the syntax required. In addition, three examples of window managers are presented to assist you in designing the appearance of your screen to suit your preferences.

A good working knowledge of Unix commands is recommended, as well as familiarity with an editor available on the Unix machines. Please refer to U-001, "Unix Resource List," for a list of additional documentation that may be helpful.


TAILORING YOUR ENVIRONMENT

The initial X Windows configuration provided for new accounts by ITC is defined in six files: .xinitrc, .xinitrc.ksh, .twmrc, .Xresources, .Xdefaults, and .dt_profile. The last two files are useful if you plan to use CDE as your windowing environment. (CDE is not covered in this document.) Listings of the first four files are included in the Appendix A of this document. Other files provided on new accounts are .xinitrc.csh (for csh or tcsh users), .mwmrc (for MWM users), and .tvtwmrc (for TVTWM users). If you have older versions of these files but want current ones, please check the files in the directory /help/unix/account.customize/startupfiles. These files may include changes that have been made since the printing of this document. Startup files referenced in this document are included in the Appendix A. The latest version of all ITC startup files can be copied into your account using the command


	install.startup

If you only want to copy the latest X Window files, you can issue the command:


	install.startup -x

Refer to the man page for install.startup for more information.

In the Unix labs, you may be using either a Sun Ultra, SGI, or an X terminal. While there are currently no publicly available RS/6000 monitors they can be found in many departmental labs. The Sun Ultras, the RS/6000s and some Sun 3/60s are stand-alone computers with color monitors. You must log in and then give the command to begin the X Windows session. When you are finished, you must shut down the window environment AND then log out from the workstation. Occasionally we may distinguish between the way things behave on a stand-alone workstation as opposed to an X terminal.

The command startx issued on a workstation causes the .xinitrc file to be read. It is automatically read when you log in on an X terminal. This, in turn, will run your .xinitrc.ksh file (assuming you are running "ksh" as your default shell). The last command in this file is exec twm which runs the Tab Window Manager causing the .twmrc file to be read. The name of this third X startup file will vary depending upon which window manager you request in your .xinitrc.ksh. If you are running TWM, the file's name is .twmrc. If you are running the Motif Window Manager (MWM), it is named .mwmrc; when you are using Tom's Virtual Tab Window Manager (TVTWM), it is .tvtwmrc. The window manager startup file (also called the resource description file) governs the appearance and behavior of the window manager interface by specifying variables, bindings for mouse buttons and keys, and menus. The .Xresources file is read by the programs that run under X to set specifications for particular X application programs.

This document will focus first on the Tab Window Manager (TWM) since it provides features that are popular with most X users, and it is the default.

.xinitrc File

This file determines what shell you use (in most cases this is "ksh") and runs the appropriate startup file. This will be .xinitrc.ksh if you are running ksh or sh and will be .xinitrc.csh if you are running csh or tcsh. This document will not cover any specific options for "csh" or "tcsh".

.xinitrc.ksh File

Some windows and utilities are created by the commands in the .xinitrc.ksh file. Several of the lines at the top of the file should not be modified -- including the line . ${HOME}/.variables.ksh. This reads in the file .variables.ksh to set your environment variables.

The following three lines appear in your startup file to prevent your "stealing" the console if you log in using an X terminal. (Actually, this is an example for the Suns. For an RS/6000 account, this line will be slightly different.) PLEASE DO NOT change them:

if [ "`tty`" = "/dev/console" ]; then

   xterm -iconic -sb -C -title 'console' ...

fi

Many X application programs (also called clients) may be customized in terms of their screen location, colors, titles, and fonts. Although the next command appears as more than one line of text, in the .xinitrc.ksh file it is a single wrapped line. The following xterm command illustrates several options:



xterm -iconic -title 'Little Window' -bg AntiqueWhite -fg NavyBlue

   -font '-misc-fixed-medium-*-*-*-*-*-*-*-*-80-*-*' 

   -n 'little' -cr RoyalBlue -geometry 80x50+0-0 &

To see all the available options, refer to the xterm man page. Frequently-used options include the following:

-iconic

causes window to be created in "closed" form

-title

string displayed in the titlebar of the window

-bg

background color of window

-fg

foreground color - used to display text in window

-cr

cursor color in window

-geometry

size and location of the window

-font

font to be used in the text area of the window

-n

string to be displayed in icon or Icon Manager window

The size and location of the xterm window is controlled with an argument of the form:

-geometry widthXheight$+-$xoff$+-$yoff

where width, height, xoff, and yoff are numbers for measures in pixels or characters, depending on the particular application. Xoff and yoff specify the distance of the window from the left or right and top or bottom edges of the screen, respectively. Positive measures are from the left and top edges, and negative measures are from the bottom and right edges. Please refer to the X man page for examples of geometry specifications, and to the application's man page for the units of measure.

Since the .xinitrc.ksh file sets up the background (or root) window, you can choose a background to be used, rather than the default stippled-gray. The following command will place the image specified in the file filename on the root area of the screen.

xloadimage -onroot -center -quiet filename&

Please refer to the man page for xloadimage to see the options and file types that may be used.

Window Managers: An Overview

The window manager controls the windowing environment. The window manager you use determines the "look and feel" of X on your workstation or X terminal.

The window manager is responsible for three kinds of window details: behavior and appearance, bindings, and menus. The terms behavior and appearance refer to such things as highlighting and borders of windows, whether to use an Icon Manager, whether windows may be moved off the screen, and where input from the keyboard will apply. Bindings are specifications for the actions that result when certain keys and/or mouse buttons are used. Menus are lists of command options which can be either Unix or Xwindows commands.

For the most part, the settings of the window manager appear in the appropriate startup file. TWM expects to read a .twmrc file; MWM looks for a .mwmrc file; and TVTWM reads a .tvtwmrc file. The appearance and behavior resources for MWM are prescribed in the .Xresources file. The syntax required in these startup files is covered in detail in the man page for the window manager. Although this document discusses many available features, there are other features you may want to try. An understanding of the concepts can help you customize the window manager you choose. See the man page for the xrdb command for more information on these concepts.

.Xresources File

What is the function of a separate "resource" file? As we saw with the xterm command, there are several options that may be given. You can use the command-line options, but there are many to remember, and time-consuming to type. Typically, you want the same options every time you run a particular X application. To free yourself from specifying these each time you use an application, you can put them in a file that will be read by X applications.

The term "resources" is often applied to user preferences. This general term includes three parts: an object, a resource of the object, and a value for the object/resource pair, which are listed in the .Xresources file, since that has been designated as the file to be read for userresources in the .xinitrc.ksh.

Objects are structured in a hierarchy that consists of objects within objects, each one of which has a name. In a resource name each object is separated by a period "." or an asterisk "*", with inner objects to the right and outer objects to the left. The name of the X Window application program (client) is outermost and farthest to the left. The most basic resource definition is the name of the client program followed by a period or asterisk and the name of the variable (resource of the object). A colon or whitespace separates the name from the value of the resource variable. Comment lines begin with an exclamation point (!), and if the last character on a line is a backslash (\), the line continues to the next line.

Many clients are X Toolkit applications, provided with a standard set of "widgets," such as buttons, scrollbars, menus, etc. There can be widgets within widgets in the object hierarchy, and the syntax of the specification parallels this hierarchy. A resource specification has the following format:


object.subobject [.subobject . . . ] .attribute: value

where

object

is the client application program.

subobject(s)

parallel the widget hierarchy (the major structures within an application; e.g. windows, scrollbars, fonts, menus, etc.).

attribute

a feature of the last subobject, such as background color or title.

value

the setting for the resource attribute; i.e., the color or text.

The following examples specify the colors for a hypothetical client's application window, button box area, command buttons, and the quit button, respectively:

xclient.buttonBox.background: BlanchedAlmond
xclient.buttonBox.commandButton.background: blue
xclient.buttonBox.commandButton.quit.background: plum

Resource values may be Boolean (such as scrollbar: on) or a numeric or string value (such as saveLines: 250 or foreground: NavyBlue). The syntax allows separate control over both the class and instance of an object. A class is a broad category that may have many instances beneath it in the widget hierarchy. In the example above, buttonBox is a class, commandButton is an instance of that class, but is itself a class, since it has a specific instance in quit.

If you look at the .Xresources file, you see both periods and asterisks used as separators. Resource specifications may be linked by a tight binding (represented by the dot, ".") or by a loose binding (represented by the asterisk, "*"). In a tight binding, the widgets must be adjacent in the widget hierarchy, whereas in the loose binding there may be additional levels between the components. The following specification does not work, because it ignores the buttonBox and commandButton classes in the widget hierarchy specified above:


	xclient.quit.background: on

It is risky to try to decipher the widget hierarchy, since it could change with new versions of the application. To have all buttonBox backgrounds set to SandyBrown, for example, we could use the loose binding, as follows:


	xclient.buttonBox*background: SandyBrown

The developers of X recommend using the asterisk ( * ), rather than the period ( . ), since the asterisk is less likely to cause a problem if the developers insert new levels into the hierarchy with new releases.

To find the variables that may be set for an application program, please consult the application man page. The syntax for specifying resources will be given, with numerous examples similar to those shown above.

There are often defaults that come with applications. If such a list is provided when the application is released, it will appear in the /usr/lib/X11/app-defaults directory. The current list of colors is in the file /usr/lib/X11/rgb.txt, which gives the name of the color, along with its Red-Green-Blue code. When there are two names for a color, you should use the one that has been made into a single word.

Tab Window Manager

TWM provides titlebars, sized windows, several forms of icon management, user-defined macro functions, two types of keyboard focus, and user-specified key and mouse button bindings. The window manager is started from an X session by the command twm. This will cause a startup file named .twmrc to be read with variable, binding, and menu specifications for window management. There are too many options to be discussed thoroughly in this document. Please refer to the man page for twm for more information.

Setting Variables

The following variables can be set in the .twmrc file to carry out the task listed:

Zoom

causes an outline to appear to suggest movement when a window is opened from its iconified state

ShowIconManager

creates a rectangular region listing icons

SortIconManager

puts icons for applications in alphabetic order

IconManagerGeometry

specifies size, location, and number of columns

IconifyByUnmapping

causes specified windows not to display an icon when closed; open them using the Icon Manager

DontIconifyByUnmapping

forces windows to be treated as icons

IconManagerDontShow

excludes specified applications from the Icon Manager list (windows that are never closed)

BorderWidth

specifies width of border surrounding window

DontMoveOff

prevents windows from being dragged off the screen

NoHighlight

disables highlighting of border when pointer is in window

NoTitle

provides an icon or window with no titlebar

TitleFont

specifies a font to be used by default for titlebars

Color

specifies color assignments if default display is not monochrome

Monochrome

specifies color assignments for monochrome screen

Please refer to the man page for twm for a complete list of variables that may be set. With TWM, once you change your .twmrc file, you may use the Window Manager menu (Button1 in the root area of the screen) and select the option "Re-read .twmrc" to see the effect of a new value for a variable.

Assigning Keys and Mouse Buttons

Once the variables have been set, functions may be assigned to key and mouse buttons. The specifications must give the key to press (Button), any additional key to be pressed (Modifier), the part of the screen over which the mouse pointer must be positioned (Context), and the function to be invoked (Function). The assignment is made using a command in the .twmrc file. The syntax for the command is as follows:

button = modifier : context : function

Please refer to the man page for twm in the section entitled "Bindings," for a complete list of values for the three fields. The three mouse keys are named Button1, Button2, and Button3. Keyboard selections are named by enclosing them in double quotes. The following chart lists some common options:

Button

button name

Modifier

key

Context

applicable area

Function

action or link

Button1
Button2
Button3
"L5"

(blank)
s (shift)
c (control)
meta

root
window
icon
title

f.raise
f.move
f.menu "menuname"
where "menuname" is
defined later in file

Menu Specification

The last major section of the .twmrc startup file is for menu specifications. A menu is created by a statement with the following format:

menu "menuname" {
"string1" function1
"string2" function2
. . .
}

The menu statement is recognized by the window manager as a signal to form a list to be displayed in a menu-type window. The menuname is the same phrase specified with the f.menu function in the Bindings section of the .twmrc file (see Function column of table on previous page). The above model shows that the menuname and the strings, which provide the text to be displayed on the menu window, must be enclosed in double quotes. The functions must be one of two types: TWM functions, which are specified with names of the form f.example or strings that are sent to the shell. The strings are of the form !"shell-command &" where the command may be any command that you would normally type on the command line. The ampersand (&) is required because shell commands must be run in the background when they are issued from the menu.

In the example that follows, we illustrate a "chained" set of menus. The startup file you have been issued does not use this technique, but it is useful for those who want menus of short lists. In the example, no menu has more than three items, and the selections have been grouped together by type.

menu "stage1" {

"startups" f.title

"x terms" f.menu "xterms"

"x progs" f.menu "programs"

}

 

 

menu "xterms" {

"x terms" f.title

"machine1" !"xterm -e rlogin machine1 &"

"machine2" !"xterm -e rlogin machine2 &"

"local" f.menu "windows"

}

 

 

menu "programs" {

"mailbox" !"xbiff &"

"calculator" !"xcalc &"

"news reader" !"xrn &"

}

 

 

menu "windows" {

"windows" f.title

"new one" !"xterm &"

"BIG one" !"xterm -geometry 104x50+0-0 &"

"little one" !"xterm -bg firebrick -fg white &"

}

It is possible to use your own icons, provided you include the following specifications in your .twmrc file:

#Force Icons to display
ForceIcons
IconDirectory "/home/
path"
Icons {
"window_name" "icon_filename"
. . .
}

where window_name matches what is specified in an application's command under the -name option, as in

xterm -name window_name -title title_name . . .

The path above is the path to place you have stored your icons. The icon_filename is the name of the file in that directory. The icons must be bitmapped files.

Motif Window Manager

This window manager provides functionality similar to TWM, since the startup files for each have been designed with comparable commands. Our focus will be on the ways in which the appearance and use of MWM differs from TWM.

The Motif Window Manager is invoked with the command exec mwm. If you want to use MWM rather than TWM, change your .xinitrc.ksh file. Remove the comment character (#) from the line exec mwm and put a # at the beginning of the line that invokes TWM. Only one window manager should run at a time. The next time your .xinitrc.ksh file is executed it will start MWM, which will read the .mwmrc file.

The most noticeable difference is in appearance: MWM decorates the windows more elaborately than TWM. There is a border that makes the windows appear to be "matted." This border has several components that may be colored separately, enhancing the appearance of the frame.

The titlebar area has a title and three buttons. The left-most button has not been enabled. There are two buttons on the right: a "minimize" button causes the window to become iconified, and the "maximize" button causes the window to fill the entire screen.

Mwm Window Manager

Figure 1: Icon Manager Display for MWM

In Figure 1, the Icon Manager shows the full icon. Each icon has two parts: a label and an image. It is possible to specify a label-only display; you may prefer the "neater" appearance this gives your screen. In the figure above, the icons for one, xv, and xv contr appear dimmer than two, because the window associated with two has been "minimized". The use of labels-only and the fading of icons are resource attributes whose settings are described in the section below.

As with TWM, the Icon Manager serves two purposes. First, it gives you a list of applications you are currently running. Second, you can open application windows that have been closed by clicking on the icon.

The Icon Manager window has scroll buttons that allow you to change your view of the icon list. The window that appears when using the current startup files has one row by four columns of icons. Since there are five applications that are started by the .xinitrc.ksh file (if a console window is included), the Icon Manager window cannot display all of them in the first row. As illustrated in the two views of Figure 1, you can click the lower scroll button on the right scroll bar (the symbol ) to access the icon in the second row.

Many X applications use scroll bars similar to the one in MWM's Icon Manager. With TWM, you could use the different buttons on the mouse to affect the scrollbar in different ways, moving up, down, or dragging the visible area. With X applications that use Motif (MWM is an example), scrolling is done with the scroll buttons instead of scrollbars. The shaded portion represents the part of the entire window's contents that you can currently see in the window.

Resource Specifications

The major difference between the TWM and MWM window managers is in how the behavior and appearance resources are specified. With TWM, these were listed as variables in the .twmrc file. With MWM, these variables must be specified in the .Xresources file. You will see a large section in the default .Xresources file devoted to this part of window management. The MWM resource names all begin with "Mwm*", which creates a loose binding between MWM and all the subobjects that follow.

Several of the resource specifications we have used are used by MWM but not by TWM. These attributes and their functions are listed below:

Mwm*fadeNormalIcon

icon fades whenever the window is open.

Mwm*iconDecoration

specify, display, or label image.

Mwm*keyboardFocusPolicy

input follows mouse pointer if pointer or click on window to activate if explicit

Mwm*interactivePlacement

place newly-opened windows.

Mwm*background

set color of text area background (available in TWM).

Mwm*activeBackground

set color of text area background when window is active (not available in TWM).

To force custom icons to be used, the following attribute should also be listed in the .Xresources file:

Mwm*my_app_name*iconImage: /somewhere/bitmaps/nice_bitmap.bm

where the icon is a bitmapped file and the path to the file is fully specified, as above. The particular client that the icon will represent is given by my-app-name.

Assigning Keys and Mouse Buttons

The features set in the .mwmrc startup file are the same as those for TWM. The file's contents are reversed, however. In the .twmrc file, the button and key bindings follow the variables, followed by the menu descriptions. In the .mwmrc file, the menus must be listed first, followed by the button and key binding descriptions. The order and syntax are described in the man page for mwm.

The menus created by the ITC default .mwmrc and .twmrc files are as close as possible in appearance. There are several commands that behave differently in the two window managers; these have been omitted from the MWM menus. For example, you cannot resize, move, or destroy a window from the root area in MWM; this must be done through the title area's menu, thus identifying the window on which the command acts. The syntax for menu specification is similar to that used by TWM:

menu menuname {
"string1" function1
"string2" function2
. . .
}

With MWM, double quotes are not necessary around the identifying menuname, but strings still must be quoted.

The syntax for button bindings is different from that used by TWM. With MWM, the modifier is attached to the button specification. The event of pressing a button must be identified by enclosing the button name in angle brackets. For bindings, the syntax is as follows:

Buttons {
modifier1<button1> context1 function1
modifier2<button2> context2 function2
. . .
}

The following example is taken from the default .mwmrc file:

<Btn1Down> root f.menu MwmMenu

Tom's Virtual Tab Window Manager

TVTWM includes a "Virtual Desktop" that makes the root area of the screen effectively larger than the size of the display. Using a panner (described below), you can alter your viewport into the root area, possibly losing sight of windows. This window manager provides a "sticky" feature through which selected windows may be stuck to the glass of the screen so that they remain visible when the viewport is changed. The same functions are available with TWM, in terms of windows and menus: moving, resizing, etc. Additional capabilities are needed to have functional control over the Virtual Desktop. These are the tasks of the panner.

To invoke TVTWM, give the command exec tvtwm by changing the last executable line in your .xinitrc.ksh file. Remove the comment character (#) from the exec tvtwm line, and put it at the beginning of the exec ... line that was active. The next time your .xinitrc.ksh file is executed, TVTWM will be started, which will in turn read your .tvtwmrc file. For the most part, the file is a duplicate of the .twmrc file discussed in the section "Tab Window Manager". Some commands in the .tvtwmrc file are used only by TVTWM; these are discussed below.

The panner is a special window providing a miniature view of the arrangement of windows on the larger Virtual Desktop. It has been set to open at the top of the screen toward the right. Figure 2 shows several views of this small panner window. In each view there is a dotted outline and a pair of white rectangular images that represent open windows. The images in the figure represent a single open window and the Icon Manager. The dotted outline represents the boundary of your screen, called the viewport. The upper left view shows the panner window as it first appears when you start TVTWM.

Using the panner window, you can change your viewport or move windows out of view. To change your viewport, press Button1 on the dotted outline, drag the outline to another location, and then release the mouse button. Your screen will adjust accordingly. In the example shown in the upper right view in Figure 2, the panner window shows half of the open window, but the Icon Manager would not be visible.

To move a window out of view, position the cursor over the image of the window in the panner, press Button2, drag the window out of the dotted representation of the screen, and release the mouse button. The lower display in Figure 2 illustrates this action. After this move, we would be able to see the top of that window and the Icon Manager.

Virtual Desktop  Virtual Desktop

Figure 2: Virtual Desktop Displays for TVTWM

Three variables used only by TVTWM are specified in the .tvtwmrc. "VirtualDesktop" enables the virtual window and specifies its size as a standard geometry string. "PannerScale" specifies the reduction factor between the panner and the terminal's screen. "Sticky" allows certain windows to be stuck to the glass so that they cannot be panned away. The command ``Stick a Window'' given in the ``Window Commands'' menu allows you to interactively make windows "sticky." This command is a toggle command, acting in an on/off manner. For other possible changes, refer to the man page for tvtwm.

Note that the .tvtwmrc file is almost identical to the .twmrc file. Exceptions include the additional variables mentioned above and one other menu item. They are listed here for reference:

Variables:

VirtualDesktop "3000x2000-0+0"
PannerScale 10
Sticky { "xclock" "xbiff" }


Menu Item:

"Stick a Window" f.stick


WHERE TO GET HELP

If Your Workstation Does Not Respond

There are several reasons your workstation may be unresponsive. Sometimes you can remedy the problem yourself. DO NOT TURN OFF THE MACHINE. These are multi-user machines, and other individuals may be doing work on the machine through a remote connection.

If keyboard control has been lost so that you cannot type, or there is no response to the mouse, try the following procedures in the order listed:

USER PID %CPU %MEM SZ RSS TT STAT START TIME COMMAND
your_id 24114 0.0 10.6 1272 792 co S Jul 18 47:07 X :0 -fp /usr/lib/X11/fonts
your_id 24115 0.0 8.5 384 632 co S Jul 18 7:07 mwm
your_id 24112 0.0 0.0 40 0 co IW Jul 18 0:00 xinit /home/your_id/.xinitrc

On the Suns, if you need to restore control to the keyboard, type the command


	kbd_mode -a

If this fails, see the consultant in Small 102, Thornton E225, or call the Infomation Technology and Communication Help Desk at 924-3731. The staff is present 8:00A.M. to 5:00P.M. Monday through Friday.

On-Line Help

Man pages are available on-line. Type man command-name or use the Manual Browser available through the ``Applications'' button menu. A printed copy of a man page can be obtained using the command manpage command. Please use this command judiciously, since it uses costly laser printing resources.

Books on X

O'Reilly & Associates, The X Window System Series

Documents from ITC

U-001, "Unix Resource List"

This document provides a comprehensive list of the Unix documents written for the University community, and includes titles referring to the operating system, editors, and applications; e.g. Mail, News, and text processing.


APPENDIX A

X STARTUP FILES

Five X startup files are included here: .xinitrc, .xinitrc.ksh, .twmrc, .mwmrc, and .Xresources. A listing of the .tvtwmrc file is not included because it is virtually identical to the .twmrc file. You can find on-line versions in /help/unix/account.customize/startupfiles.

.xinitrc File

#  This is the default .xinitrc file.

 

#  Lines beginning with # are comments.

 

#  *WARNING*  CHANGE THIS FILE AT YOUR OWN RISK!!!  For almost all 

#  situations you will want to change your .xinitrc.ksh or .xinitrc.csh

#  file instead of this one.

 

#  This is the default .xinitrc file. This file checks to see what shell 

#  you run by default and then runs the appropriate script.  The rational

#  behind this is to allow users to have only one set of files that they 

#  need to update whether they are working on an xterm or a console.

 

#  The following line finds what your default shell is

YOURSHELL=`echo $SHELL | sed 's/.*\///'`

 

#  The following line causes "sh" to run your .xinitrc.ksh if your default

#  shell is "ksh" and you are at a console.  Running .xinitrc.ksh on a 

#  console with "ksh" does not work for mysterious reasons.

if [ "`tty`" = "/dev/hft/0" ] & [ "$YOURSHELL" = "ksh" ] ; then

      /bin/sh ${HOME}/.xinitrc.ksh 

else

      case $YOURSHELL in

              'ksh') ksh ${HOME}/.xinitrc.ksh ;;

              'sh') sh ${HOME}/.xinitrc.ksh ;;

              'csh') csh -f ${HOME}/.xinitrc.csh ;;

              'tcsh') tcsh -f ${HOME}/.xinitrc.csh ;;

      esac

fi

wait

.xinitrc.ksh File

#

# .xinitrc.ksh

#

#  Refer to the man pages on X, xterm, and specific X applications

 

#  Lines beginning with # are comments.

 

# Reads in preferences about color, fonts, and so on for applications from 

# your .Xresources file.  That file should be edited to changes these

# preferences.  Do no delete casually!!

userresources=$HOME/.Xresources

 

# Reads in your keyboard modifier map and keymap table from your .Xmodmap

# file. (does not exist by default).  Run "man xmodmap" for details.

usermodmap=$HOME/.Xmodmap

 

# merge in defaults and keymaps. Do not delete casually!!

 

if [ -f $userresources ]; then

    xrdb -merge $userresources

fi

 

if [ -f $usermodmap ]; then

    xmodmap $usermodmap

fi

 

# set bell and mouse preferences.  Run "man xset" for details.

xset b 20 50 60 m 4 1

 

# Sets your TERM variable to "xterm"

TERM=xterm

 

# start some programs for your X-windows interface and, if you're on an 

# xterm, run your .variables.ksh .

 

# This causes a "console" xterm to open up if you are on the console monitor 

# of the machine. If you are not on a console, your .variables.ksh is

# sourced in.

if [ "`tty`" = '/dev/hft/0' ]; then

	xterm -iconic -sb -C -title 'console ' -geometry 80x8+0+150 \\

		 -font '*-courier-medium-r-normal--*-100-*' -n 'CONSOLE' &

else

	. ${HOME}/.variables.ksh

fi

 

# places a clock in the upper left hand corner of the screen

xclock -geometry 130x130+0+0 &

 

# places an "biff" icon in the upper right hand corner of the screen.  The

# biff icon will beep and change color when new mail arrives. 

xbiff -xrm "*iconGeometry 80x80+825+15" -geometry 80x80-0+0 &

 

# This causes an xterm (a terminal window) called "Big Window" to be created.

xterm -title 'Big Window' -geometry 80x24-0-0 \\

		-font '-misc-fixed-medium-*-*-*-*-200-*-*-*-*-*-*' -n 'BIG' &

 

# This causes an xterm called "Little Window" to be created.

xterm -iconic -title 'Little Window' -bg AntiqueWhite -fg NavyBlue -cr RoyalBlue \\

	-geometry 80x24+0-0 -font '-misc-fixed-medium-*-*-*-*-*-*-*-*-80-*-*' -n 'little' &

 

# The next command executes the Window Manager.  There are three choices: mwm,

# twm, and tvtwm.  The default is twm, but you can try out any of the others

# simply by commenting out "exec twm" and uncommenting the line you want to 

# run. ("#" at the beginning of line indicates a comment).  You must exit and

# restart x windows to see the effect.  One of these lines must *always* be

# uncommented!!

 

#exec mwm   

exec twm   

#exec tvtwm 

 

# End of .xinitrc.ksh file

.twmrc File


#

# .twmrc 

#

#     Startup file for use with the Tab Window Manager (TWM)

#  The appearance and behavior of TWM's user interface are specified

#  here by Variables, Bindings, and Menus

#

#  Refer to the man page for twm for the syntax and commands used

#  in this file.

#



#  Lines beginning with # are comments.





#############################################################

# Set window manager variables -- run "man twm" for details #

#############################################################



#Uncomment the next line to have cursor go automatically to new windows

#WarpCursor

 

# Zoom display pretty "zoom"ing animation with iconifying and deiconifying  

Zoom



# Starts the icon manager for twm

ShowIconManager



# Sorts icons in the icon manager by name

SortIconManager



# Defines the size and location of the icon manager

IconManagerGeometry "400x100+140+0" 4



# Causes all applications to not iconify outside of icon manager

IconifyByUnmapping



# Cause no icon to be created for the listed applications in the icon manager

IconManagerDontShow    { "xclock" "xbiff" "xeyes" }



# Specifies the border width of of applications in pixels

BorderWidth    3



# Causes the listed applications not to be highlighted when the pointer

# is over them

NoHighlight    { "xclock" "xbiff" "xeyes" }



# Causes no title to appear over the listed applications

NoTitle        { "xclock" "xcalc" "xeyes" "xbiff" }





# Font used for the title of applications

TitleFont       "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"

# Font used for the menus

MenuFont        "-adobe-helvetica-bold-r-normal--*-140-*-*-*-*-*-*"

# Font used for dimension window when resizing

ResizeFont      "-adobe-helvetica-bold-r-normal--*-140-*-*-*-*-*-*"

# Font used for the icon name

IconFont        "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"

# Font used for the icon manager title

IconManagerFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"





# Sets the colors for a non black and white terminal

Color

{

# Sets color of the application borders

  BorderColor "firebrick"

# Sets the foreground color for the application titles

  TitleForeground "gold"

# Sets the background color for the application titles

  TitleBackground "slateblue"

}





# Sets the "colors" for a black and white terminal

Monochrome

{

# Sets the color of the application borders

  BorderColor "black"

# Sets the foreground color for the application titles

  TitleForeground "black"

# Sets the background color for the application titles

  TitleBackground "white"

}





##########################

# Set mouse key bindings #

##########################



#    Button  = KEYS : CONTEXT : FUNCTION

#    ----------------------------------

    Button1 =      : root    : f.menu "TwmMenu"

    Button2 =      : root    : f.menu "HostMenu"

    Button3 =      : root    : f.menu "AppMenu"

    Button1 =      : title   : f.raise

    Button2 =      : title   : f.move

    Button3 =      : title   : f.menu "w_name_menu"

    Button1 = s    : window  : f.raiselower

    Button3 = s    : window  : f.menu "w_name_menu"

    Button2 =      : icon    : f.move





#####################

# Set menu commands #

#####################



menu "AppMenu" {

    "Applications"        f.title

    "Big Window"          !"xterm -sb -title 'Big Window' -geometry 80x24 -font '-misc-fixed-medium-*-*-*-*-200-*-*-*-*-*-*' -n 'BIG' &"

    "Little Window"       !"xterm -title 'Little Window' -n 'little' &"

    "Xgwis"               !"xgwis &"

    "Calculator"          !"xcalc -stip &"

    "Calendar"            !"xcalendar &"

    "Dictionary"          !"xwebster -geometry 770x340-0+30 &"

    "Font Selector"       !"xfontsel &"

    "Manual Browser"      !"xman &"

    "News Reader"         !"xrn &"

}



menu "HostMenu" {

    "Remote Systems"    f.title

    "blue.unix"         !"xterm -title 'BLUE' -sb -e rlogin blue.unix.Virginia.EDU &"

    "config.mail"	!"xterm -title 'CMS' -sb -e rlogin config.mail.Virginia.EDU&"

    "ultra1-12.unixlab"	!"xterm -title 'ULTRA1-12'  -sb -e rlogin ultra1-12.unixlab.Virginia.EDU&"

    "sgi-3.unixlab"	!"xterm -title 'SGI-3' -sb -e rlogin sgi3.unixlab.Virginia.EDU&"

    "o200-3.sp2"        !"xterm -title 'o200-3' -sb -e rlogin o200-3.sp2.Virginia.EDU &"

    "splogin.sp2"       !"xterm -title 'SPLOGIN' -sb -e rlogin splogin.sp2.virginia.edu &"

}



menu "TwmMenu" {

    "Window Commands"        f.title

    "Refresh Screen"         f.refresh    

    "Resize a Window"        f.resize

    "Move a Window"          f.move

    "Raise a Window"         f.raise

    "Lower a Window"         f.lower

    "Destroy a Window"       f.destroy

    "Re-read .twmrc"         f.twmrc

    "Re-read .Xresources"    !"xrdb -load $HOME/.Xresources"

    "Print a Window"         !"xdpr -device ps &"

    "Print Whole Screen"     !"xdpr -device ps -root &"

    "EXIT Window Manager"    f.quit

}



menu "w_name_menu" {

        "Window Name Menu"        f.title

        "Lower Window To Bottom"  f.lower

        "Raise Window To Top"     f.raise

        "Resize Window"           f.resize

        "Move Window"             f.move

        "Print Window"            !"xdpr -device ps &"

        "Destroy Window"          f.destroy

}



#

#  end of TWM startup file

#

.mwmrc File


#

#  .mwmrc

#

#     RESOURCE DESCRIPTION FILE for Motif Window Manager (MWM)

#  Resources specified within this file include Buttons, Keys, and

#  Menus.  Appearance and behavior resources for MWM are specified

#  in the file named .Xresources.

#

#  Refer to the man page for mwm for the syntax and commands used

#  in this file.

#



#  Lines beginning with # are comments.



##########################

# menu pane descriptions #

##########################



# Application Menu Description

Menu AppMenu

{

    "Applications"      f.title

    "Big Window"        !"xterm -sb -title 'Big Window' -geometry 80x24 -font '-misc-fixed-medium-*-*-*-*-200-*-*-*-*-*-*' -n 'BIG' &"

    "Little Window"     !"xterm -title 'Little Window' -n 'little' &"

    "Xgwis"             !"xgwis &"

    "Calculator"        !"xcalc -stip &"

    "Calendar"          !"xcalendar &"

    "Dictionary"        !"xwebster -geometry 770x340-0+30 &"

    "Font Selector"     !"xfontsel &"

    "Manual Browser"    !"xman &"

    "News Reader"       !"xrn &"

}





# Host Menu Description

Menu HostMenu

{

    "Remote Systems"    f.title

    "blue.unix"         !"xterm -title 'BLUE' -sb -e rlogin blue.unix.Virginia.EDU &"

    "config.mail"	!"xterm -title 'CMS' -sb -e rlogin config.mail.Virginia.EDU&"

    "ultra1-12.unixlab"	!"xterm -title 'ULTRA1-12'  -sb -e rlogin ultra1-12.unixlab.Virginia.EDU&"

    "sgi-3.unixlab"	!"xterm -title 'SGI-3' -sb -e rlogin sgi3.unixlab.Virginia.EDU&"

    "o200-3.sp2"        !"xterm -title 'o200-3' -sb -e rlogin o200-3.sp2.Virginia.EDU &"

    "splogin.sp2"       !"xterm -title 'SPLOGIN' -sb -e rlogin splogin.sp2.virginia.edu &"

}





# Root Menu Description

Menu MwmMenu

{

    "Window Commands"       f.title

    no-label                f.separator

    "Refresh Screen"        f.refresh

    "Roll Windows Forward"  f.circle_down

    "Roll Windows Backward" f.circle_up

    "Re-read .mwmrc"        f.restart

    "Re-read .Xresources"   !"xrdb -load $HOME/.Xresources"

    "Print a Window"        !"xdpr -device ps &"

    "Print Whole Screen"    !"xdpr -device ps -root &"

    "Exit Window Manager"   f.quit_mwm

}





# Window Menu Description

Menu W_Name_Menu

{

    "Window Name Menu"      f.title

    "Lower Window"          f.lower

    "Raise Window"          f.raise

    "Resize Window"         f.resize

    "Move Window"           f.move

    "Refresh Window"        f.refresh_win

    "Print Window"          !"xdpr -device ps &"

    "Destroy Window"        f.kill

}







###############################

# button binding descriptions #

###############################



Buttons DefaultButtonBindings

{

    <Btn1Down>          root         f.menu MwmMenu

    <Btn2Down>          root         f.menu HostMenu

    <Btn3Down>          root         f.menu AppMenu

    <Btn1Down>          title        f.raise

    <Btn2Down>          title        f.move

    <Btn3Down>          title        f.menu W_Name_Menu

    Shift<Btn1Down>     window       f.raise_lower

    Shift<Btn3Down>     window       f.menu W_Name_Menu

    <Btn2Down>          icon         f.move

    Meta<Btn1Down>      icon|window  f.lower

    Meta<Btn2Down>      window|icon  f.resize

    Meta<Btn3Down>      window       f.move

}

 



#

#  END OF mwm RESOURCE DESCRIPTION FILE

#

.Xresources File


!

!  .Xresources

!

!        Resource file for use with Window Managers

!  Client-specific resources may be set within this file.  

!  Attributes which may be modified include window appearance,

!  color, geometric location, fonts, and behavior.

!

!  Refer to the appropriate man page for the application:  

!   mwm, xterm, xcalc, xcalendar, xrn, etc.

!

!  Lines beginning with ! are comments.

 

! MWM Resources  --  These are only run if you are using the mwm window

!                    manager.  Run "man mwm" for details.

 

! Causes icon box to scroll horizontally only

Mwm*iconBoxSBDisplayPolicy:     horizontal

! Creates a box to place your icons

Mwm*useIconBox:			True

! Sets the icon box's size and location

Mwm*iconBoxGeometry:		10x1+160+0

! Sets the icon box's title

Mwm*iconBoxTitle:		Mwm Window Manager

! Sets where the icons will appear (on the screen, or in an icon box if it

! exists)

Mwm*iconPlacement:		left top

! "fades" icon of applications that are active

Mwm*fadeNormalIcon:		True

! Causes whatever your pointer is over to become the active application

Mwm*keyboardFocusPolicy:	pointer

! Causes all border and title decoration to appear on xclock applications

Mwm*XClock.clientDecoration:	+all

! Causes all border and title decoration to appear on xbiff applications

Mwm*xbiff.clientDecoration:	+all

! Lets you select by hand the location of a new application (unless a specific

! location is indicated when you run it)

Mwm*interactivePlacement:	True

! Sets a foreground color for every application

Mwm*foreground:			NavyBlue

! Sets a background color for every application

Mwm*background:			CadetBlue

! Sets a foreground color for the active application

Mwm*activeForeground:		gold

! Sets a background color for the active application

Mwm*activeBackground:		IndianRed

! Sets a foreground color for your menu

Mwm*menu*foreground:		NavyBlue

! Sets a background color for your menu

Mwm*menu*background:		lightsteelblue2

! Default font for your application titles

Mwm*fontList:         -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*

! Default font for your menus

Mwm*menu*fontList:    -adobe-helvetica-bold-r-normal--*-140-*-*-*-*-*-*

! Cause the xclock icon not to show up in the icon box

Mwm*XClock*clientFunctions:     -minimize

! Cause the xbiff icon not to show up in the icon box

Mwm*xbiff*clientFunctions:    -minimize

 

! TWM Resources  --  These are only run if you are using the twm window

!                    manager.  Run "man twm" for details.

 

! To add a title bar to dialog boxes

DecorateTransients:

 

! Xterm defaults -- run "man xterm" for details

! Default font for your xterms

XTerm*font:		-misc-fixed-medium-*-*-*-*-*-*-*-*-80-*-*

! Default bold font for your xterms

XTerm*boldFont:	-misc-fixed-bold-*-*-*-*-*-*-*-*-80-*-*

! Default geometry of a xterm with vt100 emulation

XTerm*vt100.geometry:		80x24

! Default geometry of all other xterms

XTerm.geometry:			80x24

! Turns on scroll bars for xterms

XTerm*scrollBar:		on

! Determines how many lines are saved after they scroll off the screen

XTerm*saveLines:		250

! Sets the default stty modes for an xterm

XTerm*ttyModes:  erase ^H kill ^X intr ^C susp ^Z

 

!

! Other application defaults 

!

 

! Calculator defaults -- run "man xcalc" for details

 

! Sets the default location of your xcalc

XCalc.geometry:         250x400-110+0

! For an HP-type calculator, use the following:

!XCalc.geometry:         340x200+800+10

 

! Calendar defaults  -- run "man xcal" for details

 

! Sets the default location of your xcal

XCalendar.geometry:     288x250+440+160

 

! XFontSel defaults  -- run "man xfontsel" for details

 

! Sets the default location of your xfontsel

XFontSel.geometry:       +0+140

 

! News reader defaults -- run "man xrn" for details

 

! Sets you default font for xrn

xrn*font: -*-lucidatypewriter-medium-*-*-*-14-140-*-*-*-*-*-*

! Sets the default news server for xrn

xrn*nntpServer:         murdoch.acc.Virginia.EDU

! Sets the default location and size for xrn

xrn.geometry:           800x760-0-0

! Sets the default location and size of your editor in xrn

xrn*Composition.geometry: 700x760-0-0

! Sets the default editor for xrn to jove

xrn.editorCommand:      xterm -e jove %s

! Sets the default editor for xrn to vi

!xrn.editorCommand:      xterm -e vi %s

! Sets xrn so it won't ask you to confirm actions

xrn.confirmBox:                 off

! Sorts news by subjects

xrn.sortedSubjects:             on

! Defines which buttons exist when looking at articles

xrn*artButtonList:      artQuit,artScroll,artNext,artNextGroup,artNextUnread,\

artCatchUp,artGotoArticle,artUnsub,artMarkRead,artMarkUnread,artPost,\

artExit,artGripe,artKillLocal

! Defines which buttons exist when looking at newsgroups

xrn*ngButtonList:       ngQuit,ngRead,ngRescan,ngCheckPoint,ngPost,ngCatchUp,\

ngSubscribe,ngUnsub,ngGoto,ngAllGroups,ngPrevGroup,ngSelect,ngMove,ngExit

 

! Gnu Emacs (xemacs) defaults

 

! defines which font is used for emacs

xemacs.font:		-misc-fixed-medium-*-*-*-*-*-*-*-*-80-*-*

! defines the size of the emacs window

xemacs.geometry: 	80x40

! sets the name of the xemacs icon

xemacs.iconName:	XEMACS

 

!

! End of .Xresources file

!


APPENDIX B

ACCESSING NETSCAPE AND MOSAIC ON A UNIX WORKSTATION

Defining the Home Page

To have UVa's WWW server as the default home page for Mosaic, the WWW_HOME environment variable must be defined to the proper URL (Uniform Resource Locator),which is http://www.virginia.edu/. For Korn shell users (ksh) edit your .variables.ksh or .profile file on your Unix account to include the following lines:

# defines home page for mosaic
WWW_HOME="http://www.virginia.edu/"

For C shell users (csh), edit your .variables.csh file to include:

# defines home page for mosaic
setenv WWW_HOME http://www.virginia.edu/

To make this active, log out and log back in again, or at the Unix prompt, type:

. ./.variables.ksh or . ./.profile or . ./.variables.csh

For Netscape users, edit your Netscape Preferences file .netscape-preferneces and place the Virginia URL after the variable called HOME_DOCUMENT:

 

HOME_DOCUMENT:      http://www.virginia.edu/

 

Using eXceed

Using MacX

Follow the steps below to create the remote command on a Macintosh for remotely starting Mosaic on a Unix Workstation.

Using an X terminal

Using a Sun Console

Using an RS/6000 Console

Exiting Mosaic or Netscape

To exit Mosaic, click and drag down on the File menu at the top left corner and select ``Exit Program'' (you will be prompted for confirmation). Similarly, to exit Netscape, click and drag down on the File menu at the top left corner and select ``Exit''.

If you have only one Mosaic window open, clicking on the Close Window button in the lower right corner will also exit the program.


WE REALLY WANT TO KNOW...
Have you found this publication useful? Are there ways we might improve or supplement it or other ITC publications? Did you find this document in Web or in hard copy? We really want your opinion. Send e-mail to:  newsdesk@virginia.edu