Rob Judd
rpjuddmath.utexas.edu
RLM 11.104, x212
September 17, 1996
The X Window System [X Window System is a trademark of the Massachusets Institute of Technology] is a program which allows a number of graphics based programs to be displayed on the screen simultaneously. Any program which is capable of running under X Windows is called an X client, and the program which is running X Windows is called an X server. Usually the client programs will be running on the same machine as the X server, but they may also be run from other machines.
For example you may be running the X server on the machine goldfish
and be running the X clients xterm, emacs, xclock and
netscape on goldfish, while running matlab on
arthur. For details on how to do this, see Section 5.1.
There are two main ways of getting the X server and an initial set of
client applications started. The method depends on the terminal you are
using. On most terminals X Windows runs permanently via a program called
xdm (X Display Manager). In this case you see a window telling you
which machine is running the X server and asking for your username and
password. Once you have logged in, xdm will start your X
environment. Otherwise you may be sitting at a terminal which you think
should be running X Windows, but all you can see after you have logged in
is the standard prompt. In this case you may start X Windows with the
command startx.
While you are using X Windows you don't communicate directly with the X
server; instead this is done via a windows manager. The two most common
ones are fvwm (the default) and twm. We recommend fvwm--it
is more modern looking, uses less memory and is easier to use. These notes
will concentrate on fvwm although most of the comments also apply to
twm. Fvwm uses three main files: .fvwmrc, the file with the
main settings for fvwm; .xsession, an executable shell script
which starts fvwm and also any initial client programs (although
fvwm can also do that); and .Xdefaults, which contains your
personal default setting for certain applications.
Section 4 discusses how to customize these files. When it
starts up, fvwm will look for these files, and if it fails to find
them use the system defaults. The first two may be found in the directory
/usr/lib/X11/ under fvwm/system.fvwmrc and xdm/Xsession
respectively.
Unless the standard defaults files are modified, pressing mouse button 1 in the title or side-bars will begin a move operation on the window. Pressing button 1 in the corner frame pieces will begin a resize operation. Pressing button 2 anywhere in the border brings up an extensive list of window operations.
Up to ten title-bar buttons may exist. Their use is completely user definable. The default configuration has a single title-bar button on the left side of the title-bar and two on the right side. The one on the left is used to bring up a list of window options, regardless of which mouse button is used. The innermost one on the right is used to iconify the window, while the outer button attempts to resize the window to fill the screen vertically. This has unpredictable results, but the window usually gets bigger.
emacs, xdvi and an xterm), while at the same
time you might be using netscape and pine and keep those on
another desktop. Fvwm starts with four desktops, but you can change
this. It is also possible to have windows which follow you around on all
desktops. Such windows are called sticky.
As well as real desktops fvwm has a virtual desktop feature.
The idea of this is that the desktop is larger than the screen (usually
twice as large) and you move to other parts of it by pushing the mouse
pointer against the edge of the screen. I hate this feature, and turn it
off (see Section 4). Others love it.
#1 which provides some useful buttons to start
up different programs. By default it is combined with the pager. It is
simple to use. The buttons are in a line along the top, and the pager is
below it. To use a button you click on it with button 1. Clicking on the
bomb button will bring up a skull and crossbones in place of the mouse
pointer. You can position this over a window you want to get rid of, and
click with button 1. Alternatively, clicking on the math button
will bring up a list of math applications you can use; select one by
clicking on it.
fvwm may be accessed via menus. There are
several ways of viewing these menus. The standard method is to position
the mouse cursor over the background and hold down one of the mouse
buttons. You can then move the highlight to one of the selections, and
release. Typically menu 1 (on button 1) brings up a list of applications
which may be launched, menu 2 contains a list of window operations and
menu 3 a list of programs which you are running. You can bring one to
the foreground (and move to the right desktop if it is on a different one)
by selecting it. Clicking on the left title button with any mouse key also
brings up menu 2.
Menus may also be bound to other objects, usually buttons on title bars of windows, buttons in the GoodStuff module or function keys.
fvwm. You position the cursor at the start of the text, and
hold down (not click) button 1. While holding down the button, move
the cursor to the end of the text, and release the button. The text should
then be highlighted. You can copy the text by clicking button 2.
This process is best understood by experimenting. However there is one
thing to bear in mind: in an application where you cannot move the cursor
with the mouse (such as pine or xterm) any text will be pasted to
the text cursor, regardless of where the mouse pointer is.
netscape &)
in a terminal window. The ampersand enables you to continue using the
terminal window while the program is running. When the program starts it
will either position itself automatically, or else you will see a frame
with the top left corner at the mouse pointer. Move the frame as required
and click with button 1.
netscape at the top right corner of you screen with size 760x800 you
would type:
netscape -geometry 760x800-0+0 &There are many X resources which may be specified; to find out what they are read in the manual pages of either
X or the application. These
are the same as the information in your .Xdefaults file.
Two more examples which I use a lot:
emacs -fn 9x15bold -T Emacs -geometry 80x40-0+0 & xterm -T "Xterm" -geometry 80x25-10-10 -sb -sl 500 -j -ls -fn 10x20 -iconic &The first starts up emacs in the top right corner of the screen, under the title, ``Emacs'' with the 9x15 bold font. The second starts a terminal window 10 pixels from the bottom and 10 pixels from the right of the screen with size 80 columns by 25 rows. The options after the geometry are in order: use a scroll bar; save the last 500 lines; use jump scrolling; start up with a login shell; use font 10x20 and the last option leaves the window as an icon until you click on it.
-e option:
xterm -T Pine -e pine &will start up
pine in a new xterm window. There are two things to
remember with this option. It must be the last option in the line, and
when the program finishes the window will disappear.
xman
xcalc
xbiff
xload
xterm -e top
ftp program; xftp or
ftptool
xclock and oclock
fvwm uses three files: .fvwmrc,
.xsession, and .Xdefaults. This section will give some ideas
about how to customize these for yourself.
.Xdefaults file so you need to
create your own. The file is just a list of resources which are specified
as strings of the form
appname*subname*subsubname...: valueBy convention, the application name is the same as the program name, but with the first letter capitalized (e.g. Emacs). Here is a selection from mine:
Xterm*vt100*font: 10x20 Xterm*saveLines: 2000 Xterm*scrollBar: true Emacs*Background: WhiteSmoke Emacs*cursorColor: Red3 Emacs*menubar*Font: -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1 Emacs*menu*Font: -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1 Emacs*popup*Font: -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1 Emacs*font: 9x15bold Emacs*geometry: 80x35+180+0 Emacs*region*attributeBackground: lavender Netscape*Navigator*geometry: 760x860-0+0Most of this is fairly easy to work out. The first three lines ensure that all my terminal windows use the 10x20 font, with 2000 lines saved and a scroll bar. Most of the other settings make sense, except for the last
emacs
one. This (together with a setting in my .emacs file) means that
when I select a region it is colored lavender.
If you don't want to create your own then you can copy ones from various people in the department by typing for example:
cp ~rpjudd/.Xdefaults ~/.XdefaultsYou should take care that you don't put contradictory information in this file, although if you do it will just get ignored. Another thing which you need to bear in mind is that some applications are very picky about the way you specify the resources.
Emacs is one of these. If you
look in my defaults file you will see that in some places there are periods
instead of asterisks:
emacs*menubar.foreground: Lavender emacs*menu*Foreground: LavenderThese two lines control different resources and each one has to be in this form. Thus, if at first it seems the resource you specify doesn't take effect then it may not be in the correct format.
Once you have created your defaults, you need to tell the X server about them. You can do this by either logging out and back in again, or with the command:
xrdb -load ~/.Xdefaults
For further information on which resources may be specified look in the man
pages for X (towards the end) for general resources. For a particular
application look in its man pages, and also in the defaults file (if it exists)
for the application. These files are in the
/usr/lib/X11/app-defaults/ directory.
.xsession file might look like
#!/bin/sh
if [ -f $HOME/.Xdefaults ]; then
xrdb -load $HOME/.Xdefaults
fi
# Put other commands here, eg xclock, xterm etc.
xclock -geometry +0+0 &
xterm -geometry +0-0 &
xterm -geometry 80x5+0+0 -C -ls &
fvwm
The first line says that this is a shell script to be executed by the
shell. The if ... fi statement checks to see if you have a defaults
file, and if you do it loads it, just as we saw above. The next lines
start up some initial applications, and then run fvwm. Pay careful
attention to the ampersands. Every line containing an application to be
run, except the last, must end with an ampersand; the last line
cannot end with one. This is so that all but one application runs
in the background, while fvwm runs in the foreground. Thus to log
out from your X Windows session you need to end fvwm with the
exit command in the menu on button 1.
If you would rather end your X session by typing control-D or logout
in a terminal window then swap the last two lines:
# Put other commands here, eg xclock, xterm etc.
xclock -geometry +0+0 &
xterm -geometry +0-0 &
fvwm &
xterm -T Logout -geometry 80x5+0+0 -C -ls
To log out you would use the window titled ``Logout''.
/usr/lib/X11/fvwm/system.fvwmrc. It is a very long and at times
complicated file, and there isn't enough space to go into it in detail
here. Do not despair, however. The file itself contains copious comments
explaining what is going on. If you want to customize it then copy it to
your home directory:
cp /usr/lib/X11/fvwm/system.fvwmrc ~/.fvwmrcand then open the file in a text editor. Then read through the comments and experiment with changing things. Once you have made some changes, save the file and then restart
fvwm to make the changes take
effect. Rather than logging out and back in again, select the
Exit Fvwm option in the menu on button 1. This will bring up a
submenu; select Restart Fvwm. If the manager doesn't like the
changes you made it will probably just ignore them.
We will discuss some parts of this file, to give you an idea. The first thing I changed were the fonts. I was going blind trying to read the menus so I changed the lines:
# Now the fonts - one for menus, another for window titles, another for icons #Font -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-* Font -*-times-medium-i-*-*-*-120-*-*-*-*-*-* WindowFont -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-* #IconFont -adobe-helvetica-medium-r-*-*-11-*-*-*-*-*-*-* IconFont fixedto give me larger fonts:
# Now the fonts - one for menus, another for window titles, another for icons Font -adobe-helvetica-medium-r-*-*-18-*-*-*-*-*-*-* WindowFont -adobe-helvetica-bold-r-normal--14-*-*-*-*-*-*-* IconFont -adobe-helvetica-bold-r-normal--18-*-*-*-*-*-*-*Note that the
# symbol means that a comment follows. Everything
after will be ignored.
For a (more than) complete list of fonts type the command
xlsfonts | less in a terminal window.
The virtual desktop feature is controlled in these lines:
########################################################################### # Set up the virtual desktop and pager #set the desk top size in units of physical screen size DeskTopSize 2x2To make the desktop the same size as the screen change the last line to:
DeskTopSize 1x1Obviously you may also increase the size of the desktop.
The next important item is
the start up function. This is a list of applications to run when
fvwm starts. You can put them all here instead of in your
.xsession file if you want. The system file has everything
commented out except for:
Function "InitFunction"
Module "I" GoodStuff
EndFunction
This line runs the GoodStuff module which we discussed in
Section 2.4. The
settings for this are lower down in the file. You can put anything you
like at this point. Here is mine:
# Stuff to do at start-up Function "InitFunction" Exec "I" xsetroot -bitmap misc/comet3.xbm & Exec "I" exec emacs -geometry 90x49-0+0 -fn 9x15bold -iconic& Exec "I" exec xclock -geometry 100x100+7+0 & Exec "I" exec xload -geometry 100x100+7+110 & Exec "I" exec xbiff -geometry +7+220 & Exec "I" exec xterm -fn 10x20 -geometry 80x30-10-10 -T Pine -e pine & Module "I" FvwmWinList Module "I" FvwmPager 0 3 EndFunctionThe first line changes my background to a pretty picture, the next five lines we have already discussed what they do, although the format is different here. When you add things you must take care to follow the same format. The last two lines start up a list of windows and the Pager, respectively. The window list is what I use instead of icons. It is simply a list which I can click on to switch to an application. The same list appears in the menu in button 3.
The last thing I will mention is how to write the menus which are bound to the mouse buttons. This is what the default looks like:
# This menu will fire up some very common utilities
Popup "Utilities"
Title "Utilities"
Exec "GNU Emacs" exec emacs &
Exec "Xterm" exec xterm &
Exec "Netscape" exec netscape &
Exec "Xfig" exec xfig &
Exec "Top" exec rxvt -T Top -n Top -e top &
Exec "Xman" exec xman &
Exec "Xmag" exec xmag &
Nop ""
Popup "Modules" Module-Popup
Nop ""
Popup "Exit" Quit-Verify
EndPopup
The format is similar to the start up function. Anything you add must
follow this. Compare this with the menu on button 1. The option starting
with Exec will run programs, while the Popup options bring up
submenus. You can write your own submenus similarly. The Nop
command just gives you a horizontal line.
Lower down in the file you will find the sections on binding commands and menus to the mouse, the function keys, and the title buttons, and on the defaults for the modules such as the Pager and GoodStuff.
I recommend that you copy the system file and then compare it with other people's. However this file is quite complicated and there are a lot of dependencies within it which are not obvious. You should not just copy someone else's file and use it, because it will probably not work. Mine, for instance, is set up for a particular screen size, and bits of it are incompatible with the standard one. Instead you should make small changes and see what effect they have, then keep going.
marie and want to run
xmaple from arthur. If you just try to
rlogin to arthur and then type xmaple then most likely
the command will fail with the message
Error: Can't open display:This happens because
xmaple is trying to open a window on
arthur but you are not on that machine. To fix this you must do two
things:
arthur to display to your displaymarie to accept input from arthur
marie is sending the display to). In a terminal
window of marie type echo $DISPLAY. You should get a response like bw3.ma.utexas.edu:0.0; if you just
get a blank line then type who and look for your username:
rpjudd ttyqa Sep 17 13:16 (bw3.ma.utexas.ed)The last item will be your display (hopefully). It may get truncated, but the important part is
bw3.
In arthur type
export DISPLAY=bw3:0.0or
setenv DISPLAY bw3:0.0depending on whether your shell is Bash or C-shell respectively. To find out which you have type
echo $SHELL. If the answer is /bin/bash then you have the Bash shell,
while /bin/csh and /bin/tcsh are versions of the
C-shell which work the same in this regard.marie type
xhost arthurto which
marie will reply
arthur being added to access control list.
arthur and display it on your
monitor.
The only tricky part of this is working out your display. If you
are at the console of a computer such as marie (ie. the computer
itself is in front of you) then the display is called marie:0.0
(this also applies to the PCs). Otherwise, you are probably using an NCD
xterminal, and you need to know its name. This will either be
bwnn.ma.utexas.edu or colornn.ma.utexas.edu where nn
is some number.
Emacs is a very large program; it is slow to start up and takes up a
lot of memory. This is deliberate, a feature of emacs rather than a
bug. However to prevent this from becoming a problem emacs must be
used correctly. The idea is that you run emacs only once,
when you first start your windows session. Once started, if you are not
using it then leave it in the background. This is much more efficient than
closing emacs and then starting it up again.
When you want to edit a different file you have two options. You can
either use the same buffer and just open the file with the commands
C-x C-f and then swap between files (buffers, actually) with
C-x b. The other option is to create a new frame. This will bring
up a new emacs window, but it will be the same copy of emacs and
thus will take a lot less memory and start faster. You can then open the
file in the new frame. To get the frame either use the Make New
Frame option in the Files menu in emacs or use the command
C-x 5 2.
Using the X Window System
This document was generated using the LaTeX2HTML translator Version 96.1 (Feb 5, 1996) Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -split 0 xwindows.tex.
The translation was initiated by Robert P. Judd on Tue Sep 17 15:31:33 CDT 1996