X Windows Basic User Interface

Previous    Next


X WINDOWS NOTES

In these notes I will give a few pointers to using X windows. The issue here is how to USE the X window system, not how to program X applications which we will discuss in a following message.

The standard source (not necessarily the best) is: X Window System User's Guide, Volume 3 T. O'Reilly, V. Quercia, L. Lamb O'Reilly and Associates Inc.

It can be found in lots of bookstores, and all over campus.

Here is a simple approach.

First you need to get the correct path to include X11 programs and utilities. Depending on machine it may be one of /usr/bin/X11 /usr/new/X11 /usr/local/X11/bin or the like (ask someone else or check with the system administrator). Remember to resource .cshrc (or .login) after changing the path and type rehash - or logout and back in.

You will also need to add a directory name to your MANPATH environment variable, possibly /usr/local/X11/man or the like, in order to access X man pages.

The manual pages have a general description of X under man X.

Use xinit to start X up. See man xinit for a full explanation. The default (xinit) will simply create a single 24x80 terminal window. The documentation describes how to create a .xinitrc file that will be automatically executed by xinit and which can be used to get several windows, clocks etc where you want them.

Once in such a window you can fire off further windows using the xterm command. Or you can have these windows setup on startup by xinit. The windows are standard shell windows. If you exit the shell in a window (type exit) then the window will go away and kill any of its child windows. Typing exit in the first window therefore exits completely from X.

These are all VT100 windows and you can make them any size, color, position you wish using options. For example you might type in the initial window, or place in the .xinitrc (see man xterm for more details):

xterm -g 80x66+20+21 -bg yellow -fg blue -bd red -cr brown -ms red -bw 2 -cu -j -rw -sl 300 -sb

These will create a new window with the following features:

-bg color: use 'color' as the background color (default white)

-fg color: use 'color' as the foreground color (default) black

-bd color: use 'color' as the border color

-cr color: use 'color' as the text cursor color

-ms color: use 'color' as the pointer color

-bw 2: make the border of width 2 pixels

-cu: fix a bug that makes more(1) misbehave in X windows

-j: do jump scrolling (makes xterm much faster).

-rw: allow reverse wraparound so cursor can move back from start of a line to end of previous line.

-sb: add a scrollbar

-sl num: save num lines above the screen and allow scrolling back through these using the scrollbar.

-g 80x66+20+21: window is 80 columns and 66 lines in size. window located at pixel x=20, y=21 on screen the point x=0 y=0 is defined to be top left corner of screen. The +20 means from left (-20 would mean from right) The +21 means from top (-21 would mean from bottom)

Also available are standard X options such as: -fn font: use 'font' as the text font (default is a fixed width font)

By adding the -t option you get a Tektronix window created instead of a VT100 window. Or, from a vt100 windoe, you can also access a Tektronix window using the mouse: press control and mouse button 2 at the same time in a window. You will see a menue, and near the end it says "switch to Tek window".

It is a good idea to use a window manager to manage your windows. A common one is twm. Just execute twm in a window, or in your .xinitrc file. You can use man twm to learn more. A window manage allows you to use the mouse to manage the window conveniently.

You can run other programs instead of xterm from windows or from .xinitrc. Generally you will want to runthese in the background (using &) as otherwise the window you execute them in will be locked up until they terminate. For example:

xclock -g 100x100-1+1 -bg yellow -bd green -bw 2 -fg red -chime -hd blue -hl gold -update 15 &

xcalc -g -1+180 -bw 2 &

will spawn a clock and a calculator in new windows using the specified colors etc. --


Previous   Next