mirror of https://github.com/tLDP/LDP
2149 lines
96 KiB
Plaintext
2149 lines
96 KiB
Plaintext
<!doctype linuxdoc system>
|
|
<article>
|
|
|
|
<title>The X Window User HOWTO
|
|
|
|
<author>by Ray Brigleb, <tt/ray@aracnet.com/
|
|
|
|
<date>v2.0, 1 September 1999
|
|
|
|
<abstract>This document contains information on configuring the X Window
|
|
environment for the Linux user, as well as for the beginning system
|
|
administrator attempting to sort through the many configuration options
|
|
and details of X Window. A basic knowledge of software configuration
|
|
and
|
|
installation is assumed, as is the presence of X on the users
|
|
system.</abstract>
|
|
|
|
<toc>
|
|
|
|
<sect>Introduction
|
|
|
|
<p>The <em>X Window System</em> is an advanced, network transparent,
|
|
windowing, graphical environment, developed at the <em>Massachusetts
|
|
Institute of Technology</em>, and first released in 1984. This document
|
|
assumes that you have installed X and it is functional. We intend to
|
|
learn how to use X productively, not so much how to compile the
|
|
programs;
|
|
most Linux distributions come with X as an option during installation,
|
|
compiled and ready to go.
|
|
|
|
<sect1>Other Sources Of Information
|
|
|
|
<p>If you are just starting out, you may find the <em>XFree86 HOWTO</em>
|
|
and <em>XFree86 Video Timings HOWTO</em>s to be more helpful, and you
|
|
should be able to find that in the same place you found this. At the
|
|
end
|
|
of the document you will also find a Bibliography And Resources
|
|
section,
|
|
to find even more information. Oh, and don't forget to read the <bf>man
|
|
pages</bf>.
|
|
|
|
<sect1>Versions Of This Document
|
|
|
|
<p>New versions of this HOWTO may be periodically posted to <url
|
|
url="news:comp.os.linux.help" name="comp.os.linux.help"> They will also
|
|
be uploaded to various Linux WWW and FTP sites, including <url
|
|
url="http://metalab.unc.edu/LDP" name="Linux Documentation Project">
|
|
web
|
|
site. The latest version can usually be found at <url
|
|
url="http://www.croftj.net/~ray/howto">, but the Metalab repository
|
|
is the canonical distribution point.
|
|
|
|
Changes in version 1.1 include more coverage of <bf>rxvt</bf>,
|
|
expanded coverage of X Resources, more trivial history of X, corrected
|
|
references to SunSite to point to MetaLab, and instructions on using
|
|
Type 1 fonts with X.
|
|
|
|
Changes in version 1.2 include much-requested coverage of using
|
|
TrueType fonts in X, more details about setting up <tt>xdm</tt>, and a
|
|
few more added resources. There is also a correction to my discussion
|
|
of screen blanking features (thanks to Heinrich Langos for the
|
|
correction!).
|
|
|
|
Changes in version 1.3 include some fixes, info for corrupted
|
|
font paths in some recent distributions, and lots more info about
|
|
basic X security. I've also added some tips about KDE and an e-mail
|
|
address update.
|
|
|
|
Changes in version 1.4 include corrections and additions from
|
|
Anthony J., and some very good security tips from Tomasz Motylewski.
|
|
|
|
Changes in this version (2.0) includes corrections from Guus Bosch,
|
|
Brian J. Miller, and myself, as well as lots of new updates and info,
|
|
and a plea for a new maintainer!
|
|
|
|
<sect1>Feedback And Corrections
|
|
|
|
<p>If you have questions or comments about this document, please feel
|
|
free
|
|
to email Ray Brigleb at my current (<tt>ray@aracnet.com</tt>) or
|
|
``permanent'' (<tt>rayola@mindless.com</tt>) address. I readily welcome
|
|
any
|
|
suggestions or criticisms. If you find any mistakes with this document,
|
|
please let me know so I can correct them in the next revision. If you
|
|
have information you would like to see in future revisions, or you
|
|
would
|
|
like to contribute to a future revision, drop me a line. I'm also
|
|
looking for more resources to add to the sections and bibliography.
|
|
While we're at it, I'm also looking for someone interested in taking
|
|
over
|
|
maintenance of this document, please let me know if you're interested.
|
|
I
|
|
think another maintainer might be able to breathe life into this
|
|
project
|
|
that I have not had as of late, and judging from the feedback I receive
|
|
this is still a very viable and useful text.
|
|
|
|
<sect1>Acknowledgments
|
|
|
|
<p>A special thanks to the HOWTO coordinator Tim Bynum for help and
|
|
suggestions, and the XFree86 Group for the man pages and help files
|
|
that
|
|
come with XFree86. I really need to thank all of those who have
|
|
written
|
|
documentation and descriptions of their offerings in the past, I have
|
|
just gleaned a selection of the most relevant items from their material
|
|
for this document. Also, thanks are due to Matt Chapman, author of the
|
|
Window Managers Guide website, and Scott Scriven, for the FVWM2 Themes
|
|
tips and tricks I stole from some of his hacks. Thanks are also due to
|
|
Joe Croft for the Internet service, invaluable to the ongoing
|
|
development
|
|
of this HOWTO, and Claire Galper, for moral support and miscellaneous
|
|
tips. Last but not least, thanks to the whole GNU/Linux community, for
|
|
everything, and Mr. Stallman, for this text editor (and philosophy).
|
|
|
|
<sect1>Copyright
|
|
|
|
<p>Copyright (c) 1998, 1999 by Ray Brigleb.
|
|
|
|
Unless otherwise stated, Linux HOWTO documents are copyrighted by their
|
|
respective authors. Linux HOWTO documents may be reproduced and
|
|
distributed in whole or in part, in any medium physical or electronic,
|
|
as
|
|
long as this copyright notice is retained on all copies. Commercial
|
|
redistribution is allowed and encouraged; however, the author would
|
|
like
|
|
to be notified of any such distributions.
|
|
|
|
All translations, derivative works, or aggregate works incorporating any
|
|
Linux HOWTO documents must be covered under this copyright notice. That
|
|
is, you may not produce a derivative work from a HOWTO and impose
|
|
additional restrictions on its distribution. Exceptions to these rules
|
|
may be granted under certain conditions; please contact the Linux HOWTO
|
|
coordinator for more information.
|
|
|
|
In short, we wish to promote dissemination of this information through
|
|
as
|
|
many channels as possible. However, we do wish to retain copyright on
|
|
the
|
|
HOWTO documents, and would very much like to be notified of any plans
|
|
to
|
|
redistribute the HOWTOs, this one in particular!
|
|
|
|
Many of the terms mentioned in this document are trade names. Unless
|
|
otherwise stated, all trademarks are property of their respective
|
|
owners.
|
|
|
|
<sect>Getting Started
|
|
|
|
<p>
|
|
|
|
<sect1>The X Window System: History and Architecture
|
|
|
|
<p>The <em>X Window System</em> was developed in the Laboratory for
|
|
Computer Science at the <em>Massachusetts Institute of
|
|
Technology</em>, as part of project Athena in cooperation with DEC,
|
|
and first released in 1984. The project lead of the main development
|
|
was Robert Scheifler, and the origins of X owe much debt to the
|
|
<em>``W''</em> Windowing package, developed by Paul Asente at
|
|
<em>Stanford</em>. In September of 1987, MIT issued the
|
|
first release of the X11 that we know and use today. As of X11R2,
|
|
control passed from MIT to the <em>X Consortium</em>, formed in January
|
|
of 1988.
|
|
|
|
Many of the ideas that went into X Window also came from research at
|
|
Xerox Corporation's <em>Palo Alto Research Center</em> (PARC), where
|
|
they were working on computers like the Parc and the Star in the late
|
|
seventies. None of these computers made it to market, but when Xerox
|
|
demonstrated a window system custom built to run <em>Smalltalk
|
|
80</em>, people were hooked. These series of three computers
|
|
demonstrated the WIMP (Windows, Icons, Menus, Pointer) interface so
|
|
well that it spawned a revolution in computing almost
|
|
overnight. Within a few years many computer users got a taste of a
|
|
windowing system of some kind, and you might say they never looked
|
|
back.
|
|
|
|
X Window is currently developed and distributed by the X Consortium,
|
|
however, a liberal license permits the existence of free and low-cost
|
|
implementations. The version of X used on Linux is XFree86. XFree86
|
|
is a collection of X servers for UNIX-like OSs on Intel x86
|
|
platforms. The work is derived from X386, and much of it is
|
|
contributed back into X11R6 thereafter. We can think of XFree86, for
|
|
all intents and purposes, to be X Window for Linux, unless you have
|
|
purchased another X server.
|
|
|
|
X Window is built upon a great many toolkits, or libraries. It is
|
|
built upon the X Toolkit Intrinsics and the Athena Widgets. Many
|
|
programs use XView or Motif tools. More still are part of a newer,
|
|
unified windowing and communication system, like GNOME or KDE. If you
|
|
find many of your programs not compiling, or are getting strange and
|
|
inexplicable errors, you may wish to make sure that you have
|
|
installed X correctly, because most of these libraries (with the
|
|
exception of Motif) are free and most likely preinstalled with X on
|
|
your system.
|
|
|
|
And remember, it's called X Window, <em>not</em> X Windows!
|
|
|
|
<sect1>Anatomy of Your Desktop
|
|
|
|
<p>There are a few basic principles and terms you should familiarize
|
|
yourself with to make using X much more straightforward. These terms
|
|
will appear over and over again in the manual pages and help files,
|
|
which it is suggested that you consult whenever necessary.
|
|
|
|
The <bf>screen</bf> is your whole ``desktop'', and the words may be used
|
|
interchangeably. Technically it means the primary video display you
|
|
view X with, and you can have more than one screen, in fact you can
|
|
have more than one computer running off a single X server. This is
|
|
beyond the scope of this humble document, but you should be aware of
|
|
the distinction.
|
|
|
|
The <bf>root window</bf> is the background of your screen. It is
|
|
referred to a window in name alone, it does not behave like any other
|
|
window, but rather you run your applications on the root window, or
|
|
put a picture on it, or just a solid color.
|
|
|
|
The <bf>window manager</bf> is the main interface between the X Window
|
|
system and the user. Without the window manager, the system would be
|
|
rather difficult to use, and would certainly not be a very productive
|
|
tool. The window manager provides such functionality as window
|
|
borders, menus, icons, virtual desktops, button bars, tool bars, and
|
|
allows the user to customize it at will, often adding to its
|
|
functionality in the process.
|
|
|
|
The <bf>pointer</bf> is the arrow or indicator of any given shape
|
|
which represents the location your mouse (or other pointing device)
|
|
corresponds to on the screen. The pointer often changes to give you
|
|
contextual feedback as to what will happen when you use the mouse at
|
|
that point on the screen.
|
|
|
|
The <bf>window</bf> is a frame in which any given application resides
|
|
which is ``managed'' by the window manager. This includes pretty much
|
|
anything except the so-called root window. Even windows which do not
|
|
appear to have frames, titles, or normal borders of any kind are being
|
|
managed by your window manger. The <bf>active window</bf> is the window
|
|
you are currently using, the window that will receive text when you
|
|
type,
|
|
and is traditionally denoted by the fact that your mouse cursor is
|
|
pointing at it, though this is not always the case. The active window
|
|
is
|
|
said to have ``focus,'' the rest of the windows on your display being
|
|
``unfocused.''
|
|
|
|
<bf>Menus</bf> and <bf>icons</bf> behave in X similar to the way they
|
|
behave in other windowing systems, and the same general principles
|
|
apply. Windows with text only are called <bf>terminal emulators</bf>,
|
|
an example would be xterm, and these basically emulate a console
|
|
text-only display, but let you multiplex and use more than one at a
|
|
time, and have many other advantages available due to their being
|
|
used in X. We shall discuss many of these later on.
|
|
|
|
<sect1>Invoking X Window
|
|
|
|
<p>Starting X can be done in several ways. On your system it may be
|
|
set up to start automatically, and you will not need to read this
|
|
section. Most Linux systems, however, presently start at the command
|
|
line upon login, and you have to decipher this for yourself.
|
|
|
|
The most basic way to start X is with <bf>xinit</bf>. This will put
|
|
you at a blank desktop, by default, and with no window manager
|
|
loaded. If no client program is specified on the command line,
|
|
<bf>xinit</bf> will look for the <em>.xinitrc</em> file to run as a
|
|
shell script, to start up client programs. If this file does not
|
|
exist, <bf>xinit</bf> will use the following command as a default:
|
|
|
|
<tscreen><verb>
|
|
xterm -geometry +1+1 -n login -display :0
|
|
</verb></tscreen>
|
|
|
|
As you see, this is not very helpful. The most common way to start X
|
|
is with the command <bf>startx</bf>. This is the most civilized
|
|
fashion to start the windowing system, but requires that you log in
|
|
from a text shell, and start the windowing system yourself. For many
|
|
Linux users this is the most common way to start X, it is also the
|
|
most flexible. You can issue commands such as the following:
|
|
|
|
<tscreen><verb>
|
|
startx -- -bpp 8 #start x in 256 color mode
|
|
startx -- -bpp 32 #start x in true color mode
|
|
</verb></tscreen>
|
|
|
|
The double dashes pass arguments directly to xinit, and this way you
|
|
can start up X in the resolution your work will require, and still
|
|
have it use the configuration files we will cover later in this
|
|
document.
|
|
|
|
<sect1>The X Display Manager
|
|
|
|
<p>The program <bf>xdm</bf> provides similar services to <bf>getty</bf>
|
|
and <bf>login</bf>, which allow users to log into a system and start
|
|
their basic shell. If you start X with <bf>xdm</bf>, however, users
|
|
need only to type in their username and password at a friendly prompt,
|
|
and they are dropped directly into the graphical environment. This is
|
|
simple and easy to use, and is seen frequently in college campuses,
|
|
cyber cafes, business environments, anywhere you have users not
|
|
necessarily familiar with Unix to any great extent.
|
|
|
|
<bf>xdm</bf> can be configured with configuration files located in
|
|
<em>/usr/X11R6/lib/X11/xdm</em> on your Linux system. The file
|
|
<tt>xdm-config</tt> is for configuring how the login screen appears to
|
|
users, and <tt>Xsetup_0</tt> is used to tell xdm what programs should
|
|
be launched when X is started. Some of the configuration a normal user
|
|
would put in their <tt>.xinitrc</tt> file should go in here, if xdm is
|
|
to be normally used.
|
|
|
|
Here is a sample <tt>Xsetup_0</tt> file to look at, which might help to
|
|
configure your system. The <tt>xfstt</tt> program is the TrueType font
|
|
server, and is discussed later in this document. Also, notice that
|
|
we're using a shell script here, and it's trying to call <bf>xv</bf> to
|
|
set the background to a nice picture (instead of the boring black and
|
|
white background pattern), and if that call fails, <bf>xsetroot</bf> is
|
|
called, to at least try to set the background to a nice blue color.
|
|
|
|
<tscreen><verb>
|
|
#!/bin/sh
|
|
xconsole -geometry 480x100-0-0 -daemon -notify -verbose -fn \
|
|
'-schumacher-clean-medium-r-*-*-10-*-*-*-*-*-*-*' -exitOnFail
|
|
/usr/X11R6/bin/xfstt &
|
|
/usr/X11R6/bin/xv -quit -root \
|
|
/usr/local/share/WindowMaker/Backgrounds/InDreams.jpg \
|
|
|| xsetroot -solid darkblue
|
|
xset fp+ unix/:7100
|
|
</verb></tscreen>
|
|
|
|
Many distributions of Linux include this facility automatically. If you
|
|
are able to look at the run levels for your Linux system, you can
|
|
probably
|
|
see that run level 3 is the normal startup (look under
|
|
<tt>/etc/rc.d</tt>)
|
|
unless you're booting into something like <em>xdm</em>. If you are,
|
|
you're
|
|
going to be starting in run level 5. This is something of a standard on
|
|
Linux (and similar) systems. Programs such as <em>linuxconf</em> and
|
|
its
|
|
functional equivalents should be able to adjust this.
|
|
|
|
Also on many newer Linux systems are facilities such as <em>gdm</em> and
|
|
<em>kdm</em>, which are GNOME and KDE aware equivalents of this program.
|
|
Primarily, this just changes the look and feel to suit your desktop
|
|
preferance, but often these other versions contain more features, such
|
|
as
|
|
remembering which desktop environment you last logged in to, the ability
|
|
to shutdown and reboot from the console, and so forth.
|
|
|
|
<sect>Choosing a Window Manager
|
|
|
|
<p>This is a discussion of the window managers available to the X
|
|
Window user, with a comparison of some finer ones to choose from. In
|
|
order to prevent this document from becoming overwhelmingly large
|
|
(and proportionally difficult to maintain, as well) I am limiting the
|
|
discussion to the more popular and well known window managers out
|
|
there. I believe these are most representative for our purposes, and
|
|
once you grasp the basic concepts of a few, you more or less will
|
|
have the hang of them all.
|
|
|
|
Your choice of window manager can dramatically influence how pleasant
|
|
your computing experience will be. You spend much of your time
|
|
dealing with windows when you're in X, and you don't want something
|
|
that's too obtrusive, one that will get in your way. Some window
|
|
managers are extremely customizable, to the point that you can pretty
|
|
much feel like it's a new operating system. If you don't like icons,
|
|
get rid of them! If you miss that toolbar, you can build a better
|
|
one, and it can be a pretty painless and rewarding process besides.
|
|
|
|
<sect1>FVWM And Its Ancestors
|
|
|
|
<p>The most common window managers nowadays have their roots in Robert
|
|
Nation's FVWM window manager. These include FVWM, FVWM2, FVWM95, and
|
|
many
|
|
more. FVWM itself is derived partly from TWM, which comes with an X
|
|
Window installation, but which we will not cover here. The syntax and
|
|
usage of TWM is similar to FVWM, but it actually uses more memory, and
|
|
feels clumsy and awkward to most users.
|
|
|
|
FVWM is the original and old standby favorite Linux window manager. Now
|
|
that the 2.0 of versions of FVWM have become stable and in more general
|
|
usage, this newer version is preferred, for the syntax is much more
|
|
direct and simplified, and much more flexible as well. However, many
|
|
people still have the original FVWM on their systems, as it has been a
|
|
long
|
|
time favorite and standard, and most of the examples in this text are
|
|
equally applicable to this older version. And if the older one is
|
|
working
|
|
fine for you, there may be no need to upgrade, since it may break your
|
|
configuration files to some degree, for some of the syntax has indeed
|
|
changed, and is not altogether backward compatible. Such is the nature
|
|
of
|
|
progress.
|
|
|
|
Nobody seems quite sure what F in FVWM stands for (not even the author,
|
|
from what I can tell!), but the VWM would seem to (correctly) indicate
|
|
Virtual Window Manager, and indeed the FVWM series are virtual window
|
|
managers, and that is one of their strengths. You can bind keys to any
|
|
function, including the switching between the virtual desktops, and do
|
|
this with ease.
|
|
|
|
<bf>FVWM2</bf> is the new standard, including many improvements and
|
|
features not found in the previous version. Unlike many newer window
|
|
managers, it works just fine on 8-bit, 256 color displays, which I am
|
|
using at the moment, and still can be improved with little icons and
|
|
gradients, to look as much like the Win98 interface as you may or may
|
|
not
|
|
want. This version is also much more extensible in general, and allows
|
|
the use of themes and dynamic menus. Technically, FVWM2 is still in
|
|
beta,
|
|
but it works just great, and I have not yet had a single problem with
|
|
it.
|
|
|
|
<descrip>
|
|
<tag>Resources:</tag>The official FVWM and FVWM2 site is <url
|
|
url="http://www.hpc.uh.edu/fvwm/">. The latest version should always
|
|
be
|
|
available at <url url="ftp://ftp.hpc.uh.edu/pub/fvwm/">.
|
|
</descrip>
|
|
|
|
<sect1>The Wide World of Window Systems
|
|
|
|
<p>For users more familiar with other window environments on other
|
|
operating systems, there are plenty of window managers to emulate the
|
|
desktop you're accustomed to.
|
|
|
|
The <url url="http://berta.fri.uni-lj.si/~markom/icewm" name="icewm">
|
|
window manager is aimed at a more consistent look and feel, and can
|
|
emulate many other windowing system standards, hot key bindings, and
|
|
such.
|
|
The OS/2 emulations are particularly nice.
|
|
<url url="http://www.lysator.liu.se/~marcus/amiwm.html"
|
|
name="AmiWM"> is an Amiga Workbench type window manager, <url
|
|
url="http://www.bioele.nuee.nagoya-u.ac.jp/member/tak/mlvwm.html"
|
|
name="mlvwm"> is a MacOS emulator. A nice addition to these window
|
|
managers is <url
|
|
url="http://www-c.informatik.uni-hannover.de/~kaiser/dfm/dfm.html"
|
|
name="dfm">, a desktop and file manager that pleasantly resembles the
|
|
OS/2 Workplace Shell.
|
|
|
|
<descrip>
|
|
<tag>Resources:</tag>The Window Managers website can be found at <url
|
|
url="http://www.PLiG.org/xwinman/">, and is a consistently good
|
|
resource for finding out about the variety of window managers
|
|
available, particularly for finding good window managers to emulate
|
|
other windowing environments. Many more still are listed at <url
|
|
url="http://www.PLiG.org/xwinman/others.html">, provided by the same
|
|
author as the previous link, and this is quite a formidable and
|
|
complete list indeed. You can download Linux versions of most popular
|
|
window managers at the <url
|
|
url="ftp://metalab.unc.edu/pub/Linux/X11/window-managers"
|
|
name="metalab"> archive.
|
|
</descrip>
|
|
|
|
<sect1>The X Graphical Interfaces
|
|
|
|
<p>Open Look and Motif were early attempts to standardize X Window,
|
|
and make it usable in more mainstream environments, around a greater
|
|
variety of workstations. Both were somewhat successful at those
|
|
attempts (in look and feel, if not politically) and can be used under
|
|
a modern Linux system. Both require specific libraries, which can be
|
|
used to compile a variety of applications specifically designed for one
|
|
or the other environment, to give all programs a similar look and feel.
|
|
|
|
Starting with X11 Release 5, Sun Microsystem's <bf>OpenWindows</bf>
|
|
graphical interface was available to X users. This includes two
|
|
versions
|
|
of the Open Look Window Manager, <em>olwm</em> and <em>olvwm</em> (with
|
|
a virtual desktop). This was developed by Sun in hopes of making a
|
|
standard windowing environment, and indeed it was standard with Solaris
|
|
for many years. If your distribution of Linux did not come with this
|
|
windowing system installed, you must remember to install the
|
|
<em>XView</em> libraries to get it to work, and you will also have to
|
|
put
|
|
the <em>/usr/openwin/...</em> directories in your search path.
|
|
|
|
If you want the actual <bf>OSF/Motif Toolkit</bf> for Linux, you'll have
|
|
to pay, the programs and toolkit are not free. However, the <em>Hungry
|
|
Programmers</em> have written <bf>LessTif</bf>, which allows you to
|
|
compile Motif programs more or less as if you owned to toolkit. LessTif
|
|
is a clone of the Motif toolkit. Currently LessTif is partially
|
|
implemented with most of the API in place. Many programs already work
|
|
under this free version of the toolkit, and it even comes with a window
|
|
manager, derived from FVWM code, which you'd swear was the Motif Window
|
|
Manager.
|
|
|
|
The most useful feature of this toolkit, however, is compiling programs
|
|
dependent on having a Motif library on your system. The window manager
|
|
is
|
|
nothing spectacular, and mostly useful if you're migrating from the
|
|
original Motif, and want to keep your configuration file. For all
|
|
intents
|
|
and purposes, you will find FVWM much more feature-filled and useful,
|
|
and
|
|
it looks and behaves almost identically, even recognizing the window
|
|
hints supplied by programs built with the Motif toolkit.
|
|
|
|
<descrip>
|
|
<tag>Resources:</tag>The Hungry Programmers LessTif can be found at
|
|
<url url="http://www.lesstif.org/">.
|
|
</descrip>
|
|
|
|
<sect1>The X Desktop Environments
|
|
|
|
<p>The second generation of Linux window managers was brought about by
|
|
KDE, and soon joined by GNOME. There are some striking similarities,
|
|
and some great differences, between these two, and I will attempt to
|
|
cover them here. The most important thing to remember at this point
|
|
is that neither of them is in any way a complete product. Both are at
|
|
the start of a long development cycle, and not completely stable yet,
|
|
and
|
|
as such are not suited to mission-critical work at this time.
|
|
|
|
<bf>The KDE Desktop Environment</bf>
|
|
|
|
(A quote from the home page:) <em>``KDE is a completely new desktop,
|
|
incorporating a large suite of applications for Unix
|
|
workstations. While KDE includes a window manager, file manager,
|
|
panel, control center and many other components that one would expect
|
|
to be part of a contemporary desktop environment, the true strength
|
|
of this exceptional environment lies in the interoperability of its
|
|
components.''</em>
|
|
|
|
The KDE Desktop Environment is an attempt to make a desktop
|
|
environment, not just a window manager. The tools of KDE work
|
|
together so well, for instance, one might be fooled into thinking KDE
|
|
was an entire operating system. All the tools to work in a windowing
|
|
system are included, and many more have been ported to the KDE
|
|
environment. KDE has achieved a surprising level of maturity already,
|
|
but many are reluctant to install it on their desktop, because of the
|
|
licensing stipulations of the QT toolkit, upon which KDE is based. This
|
|
has changed a little lately, and the licence now qualifies as Open
|
|
Source
|
|
by definition, but is not the same as that of GNU software.
|
|
|
|
For those just looking to get down to business, KDE is often the way to
|
|
go. This project has been around for some time now, and has let go of
|
|
some flashiness for the ability to get lots done. In many ways you can
|
|
become fooled into thinking you're using a product strikingly similar
|
|
to the good parts of Windows. Which can be a good thing. But it can
|
|
also be somewhat frustrating, and one longs after a while for something
|
|
a little different from the paradigm upon which KDE is firmly based.
|
|
|
|
<bf>GNOME: The GNU Object Model Environment</bf>
|
|
|
|
(A quote from the home page:) <em>``GNOME stands for GNU Network
|
|
Object Model Environment. The GNOME project intends to build a
|
|
complete, user-friendly desktop based entirely on free
|
|
software. GNOME is part of the GNU project, and GNOME is part of the
|
|
OpenSource(tm) movement. The desktop will consist of small utilities
|
|
and larger applications which share a consistent look and feel. GNOME
|
|
uses GTK+ as the GUI toolkit for all GNOME-compliant
|
|
applications.''</em>
|
|
|
|
The GNOME project is an attempt to do much of the same work as KDE,
|
|
but even a little more than that. GNOME is less tied to one window
|
|
manager, for instance, and it is interoperable not just between
|
|
applications, but computers and platforms, as it uses the Common
|
|
Object Resource Broker Architecture (CORBA). Also, and to many most
|
|
importantly, GNOME is based on the GTk+ toolkit, which is free and
|
|
open source, unlike the underlying toolkit of KDE, thereby following
|
|
in the philosophy of Linux itself.
|
|
|
|
<descrip>
|
|
<tag>Resources:</tag>The official KDE website is <url
|
|
url="http://www.kde.org/">. The official GNOME website
|
|
is <url url="http://www.gnome.org/">. More
|
|
detailed information regarding the issues surrounding GNOME can be
|
|
found at <url url="http://www.gnome.org/gnomefaq/FAQ.txt">. The home
|
|
page of CORBA is located at <url url="http://www.corba.org/"> , and the
|
|
GTk+ toolkit home is <url url="http://www.gtk.org/"> .
|
|
</descrip>
|
|
|
|
<sect1>The Flashy Window Managers
|
|
|
|
<p>The latest generation of window manger is very very pretty
|
|
indeed. Sporting every convenience you could think of, and emulating
|
|
the most beautiful operating systems ever used on the most gorgeous
|
|
workstations in the world, these are the window managers to run if
|
|
you've got the memory and CPU cycles to burn.
|
|
|
|
<bf>Window Maker</bf>
|
|
|
|
(A quote from the home page:) <em>``Window Maker is an X11 window
|
|
manager designed to give additional integration support for GNUstep
|
|
applications. It tries to emulate the elegant look and feel of the
|
|
NEXTSTEP(tm) GUI. It is relatively fast, feature rich, and easy to
|
|
configure and use.''</em>
|
|
|
|
A big strength of this window manager is that it supports the GNU
|
|
desktop, meaning that it makes a great and very pretty front-end to
|
|
GNOME. This is also one of the most easily configurable window
|
|
managers, and can be configured from a graphical interface, and
|
|
supports the OffiX drag and drop protocol, easy switching of desktop
|
|
themes, and it's now available within the popular Red Hat
|
|
distribution, so it's easy and painless to switch from FVWM when the
|
|
mood finally strikes. As of the 0.50 release, Window Maker supports KDE
|
|
compliance as well.
|
|
|
|
<bf>AfterStep</bf>
|
|
|
|
(A quote from the home page:) <em>``AfterStep is a Window Manager
|
|
for X which started by emulating the NEXTSTEP look and feel, but
|
|
which has been significantly altered according to the requests of
|
|
various users. Many adepts will tell you that NEXTSTEP is not only
|
|
the most visually pleasant interface, but also one of the most
|
|
functional and intuitive out there. AfterStep aims to incorporate the
|
|
advantages of the NEXTSTEP interface, and add additional useful
|
|
features. The developers of AfterStep have also worked very hard to
|
|
ensure stability and a small program footprint.''</em>
|
|
|
|
<bf>Enlightenment</bf>
|
|
|
|
Enlightenment is more than just a window manager, it is an extreme,
|
|
detailed, and configurable environment, and is particularly
|
|
attractive in that it allows irregular and completely customizable
|
|
window shapes. It is open in design, and instead of dictating a
|
|
policy it allows the user to define their own policy right down to
|
|
the minute and infinitesimal details; from its functionality right on
|
|
through to its looks.
|
|
|
|
If you are using GNOME, you will find that Enlightenment is the default
|
|
window manager, and in fact, it must be installed for GNOME to
|
|
function. It is also basically the de facto implementation of the
|
|
GNOME features for integration, making it the most practical choice
|
|
for a desktop in that situation. Many other window managers will work
|
|
alright with GNOME, but you will find that Enlightement excels.
|
|
Unfortunately, it is still in development, and runs slowly and
|
|
imperfectly from time to time.
|
|
|
|
<descrip>
|
|
<tag>Resources:</tag>The official Window Maker website is <url
|
|
url="http://www.windowmaker.org/">. The official
|
|
AfterStep website is <url url="http://www.afterstep.org/">.
|
|
Enlightenment can be found, somewhat
|
|
predictably, at <url url="http://www.enlightenment.org/">.
|
|
</descrip>
|
|
|
|
<sect>Working In X
|
|
|
|
<p>In this section we will become familiar with running clients in X
|
|
Window and the basic procedures involved in using the system. X is not
|
|
an
|
|
intuitive interface on its own, and without any window manager, it is
|
|
easiest to use as a display for programs started from the command
|
|
line. One of the most common uses for X is just to have several xterm
|
|
windows open at the same time. Not exactly maxing out the graphics
|
|
capabilities of the computer, but it's a nice feature to start with.
|
|
|
|
The flexibility and usefulness of the command line is so great, in
|
|
fact, that you don't really need a window manager. It's nice, and you
|
|
will want it very quickly, but the fact is that you can get by
|
|
without one, just the command line and the mouse. If you give it a
|
|
shot, you'll be surprised as to the exact distinctions between the
|
|
clients and the window manager. If you start toying around with this,
|
|
however, <em>remember</em> that the key combination Ctrl-Alt-Backspace
|
|
gets
|
|
you out of X Window in a pinch.
|
|
|
|
<sect1>Command Line Options
|
|
|
|
<p>Most X programs try to use the same basic names for command line
|
|
options. All applications written using the MIT X Toolkit Intrinsics
|
|
automatically accept the following options:
|
|
|
|
<descrip>
|
|
|
|
<tag>-display <em>display</em></tag>This option specifies the X server
|
|
to use. See the section on Display Names for details.
|
|
|
|
<tag>-geometry <em>geometry</em></tag>The initial size and location of
|
|
the window, in a format such as
|
|
<em>width</em>x<em>height</em>+<em>hoffset</em>+<em>voffset</em> or
|
|
+<em>hoffset</em>-<em>voffset</em>. Note that if you put in a
|
|
negative horizontal or vertical offset, the window will be placed
|
|
counting backward from the right or the bottom of the screen,
|
|
respectively.
|
|
|
|
<tag>-font <em>font</em></tag>The font to use for displaying the text
|
|
in your window.
|
|
|
|
<tag>-bg <em>color</em></tag>The color to use for the window
|
|
background.
|
|
|
|
<tag>-fg <em>color</em></tag>The color to use for the window
|
|
foreground.
|
|
|
|
<tag>-name <em>resource-name</em></tag>Useful for specifying the name
|
|
under which the resources for this application will be found. This is
|
|
useful to distinguish between invocations of the same application,
|
|
for example, two <bf>xterm</bf>s can be named differently so that
|
|
they may inherit different resources based upon those names in the
|
|
resource database.
|
|
|
|
<tag>-title <em>string</em></tag>This is the title to be used for the
|
|
window on your display, generally used by the window manager to put a
|
|
descriptive title at the top of the window. Not to be confused with
|
|
the <bf>-name</bf> option.
|
|
|
|
<tag>-iconic</tag>Invoke window as an icon.
|
|
|
|
<tag>-xrm <em>resource-string</em></tag>This option specifies a
|
|
resource name and value to override any defaults that may already be
|
|
set. Also useful for setting X resources that do not have explicit
|
|
command line options. For instance, the command line <tt>xterm -xrm
|
|
"xterm*background: blue"</tt> is functionally identical to
|
|
typing <tt>xterm -bg blue</tt>.
|
|
|
|
</descrip>
|
|
|
|
<sect1>Display Names
|
|
|
|
<p>Every X Server has a display name of the form:
|
|
|
|
<em>hostname:displaynumber.screennumber</em>
|
|
|
|
The <em>hostname</em> specifies the name of the machine to which the
|
|
display is actually, physically connected. The <em>hostname</em> can
|
|
be omitted, and if so, the server on the same machine will be
|
|
chosen. In fact, if you are the only one using X on your computer,
|
|
you will want to just leave this off of your display
|
|
specifications. The <em>displaynumber</em> should probably be zero,
|
|
this is used if the X Server is controlling more than one keyboard
|
|
and monitor unit, for instance, a network of X terminals. The
|
|
<em>screennumber</em> specifies which monitor in a multiple monitor
|
|
setup should be used. Following this specification, you would open an
|
|
<bf>xterm</bf> window on your local machine with the option
|
|
<bf>-display :0.0</bf>. You can see that we have omitted the
|
|
<em>hostname</em> from the option, so the current machine is assumed.
|
|
|
|
On Linux systems, your <em>DISPLAY</em> variable holds your display
|
|
name, which on my system is <bf>:0.0</bf>. This is usually set by
|
|
<bf>xterm</bf>, or one of the scripts that starts X Window for you,
|
|
although you can set it yourself, or as discussed above, use the
|
|
<bf>-display</bf> command line option when invoking your application.
|
|
|
|
If you have opened an <bf>xterm</bf> or <bf>rxvt</bf> window, and then
|
|
opted to do super-user work via the <tt>su</tt> command, you will find
|
|
that if you try to launch an X application you will have no display to
|
|
launch it on. Silly it seems, because you are sitting right in front of
|
|
your display, but the trick to getting this to work is to pass an
|
|
option
|
|
on the command line to the program such as <tt>-display :0.0</tt>, and
|
|
it
|
|
will work fine.
|
|
|
|
<sect1>XTerm Versus Rxvt, or, Know Thy Terminal Emulator
|
|
|
|
<p>Your choice of <bf>terminal emulator</bf> can affect your experience
|
|
in
|
|
X almost as much as your window manager, so a little discussion of your
|
|
best options is due here. A terminal emulator is a program such as
|
|
<bf>xterm</bf>, discussed above, which lets you emulate the simple
|
|
console
|
|
of Linux in X. You will rely heavily on the program you choose, so it
|
|
pays to choose it wisely to begin with.
|
|
|
|
If you have a slow video card, the first thing you should consider doing
|
|
is switching to <bf>rxvt</bf>. Using <bf>xterm</bf> is a good starting
|
|
point, mainly because it comes standard with all X distributions, but
|
|
it's
|
|
not always the best choice. It contains a lot of legacy code, and is
|
|
quite bloated for a simple terminal emulator. This is partly due to the
|
|
fact that it's not just a plain text terminal emulator, but also
|
|
emulates
|
|
graphics modes that you simply will never use. Because of this, you may
|
|
wish to switch to <bf>rxvt</bf>, and also because <bf>xterm</bf> can be
|
|
extremely slow. I'm not sure why it's so slow, but if you have a slow
|
|
video card you'll know what I mean, and you'll be amazed at the
|
|
difference
|
|
when you dump <bf>xterm</bf>.
|
|
|
|
Some other perks of <bf>rxvt</bf> include pixmap backgrounds, and a much
|
|
nicer scrollbar. If you specify the <tt>-pixmap</tt> option on the
|
|
command line (and have support compiled in to your version!) you will
|
|
get
|
|
any <tt>.xpm</tt>-type picture in the background. A very cool feature,
|
|
and it surprisingly doesn't slow down your output at all, it still
|
|
redraws
|
|
faster than your <bf>xterm</bf> window. Give it a shot, I haven't seen
|
|
it
|
|
around lately but I think it can be found on metalab.
|
|
|
|
<sect>X Startup
|
|
|
|
<p>We will presume for the following examples that we have picked a
|
|
fairly stable window manager, such as <bf>FVWM2</bf>, to try out some
|
|
sample configurations. I would suggest giving that a shot for the
|
|
purpose of learning these topics, as most of what you will learn here
|
|
and in the following sections will apply to any window manager out
|
|
there, but the topics seem most easily picked up using FVWM2.
|
|
|
|
<sect1>A Sample Starting Configuration
|
|
|
|
<p>Our first step is to write ourselves an initialization file for X
|
|
itself. This file can be either a system-wide file, in which case it
|
|
would likely be placed in <em>/var/X11R6/lib/xinit/xinitrc</em>, or
|
|
it can be overridden on a per-user basis by placing the file
|
|
<tt>.xinitrc</tt> in your home directory. Generally, it is expected
|
|
that there will be a basic, default file in the system-wide location,
|
|
possibly enforced if necessary for security reasons, but otherwise
|
|
users will probably wish to configure the file themselves.
|
|
|
|
First let's create a file in your home directory called
|
|
<tt>.xinitrc</tt>. Open up your ``favorite'' text editor, and paste
|
|
the following, or something like it, in that file:
|
|
|
|
<tscreen><verb>
|
|
#!/bin/sh
|
|
|
|
# if your backspace and delete are reversed, try this:
|
|
xmodmap -e "keysym BackSpace=Delete" -e "keysym
|
|
Delete-BackSpace"
|
|
|
|
xsetroot -solid darkslateblue
|
|
|
|
# start some basic applications
|
|
xclock -geometry 96x96+2+2 -bg grey40 -fg black -hl white &
|
|
xload -geometry 120x96+2+147 -bg grey40 -fg white -hl darkred -update 4
|
|
&
|
|
xterm -sb -ls -geom 80x25-2+2 -title "shell" &
|
|
xterm -sb -ls -geom 80x25-2-2 &
|
|
|
|
# start the window manager
|
|
/usr/X11R6/bin/fvwm2
|
|
</verb></tscreen>
|
|
|
|
There are plenty of things to learn from this example. First of all,
|
|
this file will be a shell script, as indicated by the first line. The
|
|
<bf>xsetroot</bf> command on the second line turns the background of
|
|
our desktop to a pleasant blue color, not a bad idea if we're going
|
|
to be staring at that color predominantly all day.
|
|
|
|
The third and fourth lines are some programs that I like to leave
|
|
running while I'm fast at work. You'll notice that some of the
|
|
options make for a nicer setup, for example, specifying the colors
|
|
and geometry (location on screen). I'll give you some tips for
|
|
figuring this stuff out in a bit. The fifth and sixth lines follow
|
|
similarly, opening up two handy <bf>xterm</bf> windows for us, which
|
|
we will no doubt be needing soon.
|
|
|
|
The last line is very important--it is this line that starts up your
|
|
window manager! Notice that the only commands we did not run as
|
|
<em>background processes</em> (by putting the <bf>&</bf> at the
|
|
end)
|
|
were <bf>xsetroot</bf>, <bf>xmodmap</bf>, <bf>fvwm2</bf>. With these
|
|
first two it doesn't matter, as the programs exit immediately. But all
|
|
the rest of the programs have to be in the background, otherwise when
|
|
you
|
|
closed one, it would kill your X Window session. That would not be very
|
|
pleasant, nor very expected. As shown above, when you close
|
|
<bf>fvwm2</bf>, you exit X.
|
|
|
|
<sect1>A More Intelligent Startup
|
|
|
|
<p>We can add lots to our primitive example of a startup file. For
|
|
instance, this is a good way to warn yourself when you may have
|
|
carelessly stared X as the root user. Red Hat users seem to do this
|
|
often, for many of the configuration programs which must be run as
|
|
root,
|
|
must also be run in X. You can avoid this by issuing an <bf>su</bf>
|
|
command to become root during your normal X user session, and then
|
|
calling the program you need to run as root with the option
|
|
<bf>-display
|
|
:0.0</bf> discussed above.
|
|
|
|
<tscreen><verb>
|
|
# change background color for root
|
|
if [ "$USER" = "root" ];
|
|
then
|
|
xsetroot -solid darkred
|
|
else xsetroot -solid darkslateblue
|
|
fi
|
|
</verb></tscreen>
|
|
|
|
This will check to see if you are the user named root, and if you are,
|
|
it will set the background to a harsh red, rather than the usual
|
|
friendly blue, to warn you. This next bit of code, also intended for
|
|
your
|
|
<tt>.xinitrc</tt> file, will merge in your user-specific and
|
|
system-wide
|
|
resources, first checking to be sure the files exist.
|
|
|
|
<tscreen><verb>
|
|
userresources=$HOME/.Xresources
|
|
usermodmap=$HOME/.Xmodmap
|
|
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
|
|
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
|
|
# Merge in defaults and keymaps
|
|
if [ -f $sysresources ]; then
|
|
xrdb -merge $sysresources; fi
|
|
if [ -f $sysmodmap ]; then
|
|
xmodmap $sysmodmap; fi
|
|
if [ -f $userresources ]; then
|
|
xrdb -merge $userresources; fi
|
|
if [ -f $usermodmap ]; then
|
|
xmodmap $usermodmap; fi
|
|
</verb></tscreen>
|
|
|
|
<sect1>Getting The Windows Where You Want Them
|
|
|
|
<p>Placing everything on your screen by guesswork with the
|
|
<em>-geometry</em> option can get very tedious indeed. Particularly
|
|
when you consider that you can specify the <em>-geometry</em> option
|
|
to pretty much any program you can run in X. This allows a great
|
|
precision in tuning the interface, but that's a heck of a lot of
|
|
options to set, indeed.
|
|
|
|
This brings up one very nice feature of the FVWM window managers. By
|
|
default, when you move a window around the screen, you see the
|
|
geometry specification appear on the screen. Go ahead, try moving a
|
|
window around with the left button. Now try resizing it. As you can
|
|
see, you can get some primitive specifications this way. However,
|
|
even this method can be a little difficult, and it would be nice to
|
|
have all the details about your window in one concise list.
|
|
|
|
It is at this point that we will introduce the program
|
|
<bf>xwininfo</bf>. To use this program, go to an <bf>xterm</bf>
|
|
window and type in that program name. It will ask you to click on
|
|
another window that you want information about, and after you click
|
|
it will dump out useful information that it knows about that window.
|
|
This is useful for plugging information about windows once you have
|
|
them set up how you want them on your screen - run this program, then
|
|
click on the window, then put in those parameters in your startup
|
|
file, and your window system will henceforth be frozen in a pristine
|
|
state of immaculate precision.
|
|
|
|
<sect>Configuring the Window Manager
|
|
|
|
<p>Now we take a look at the files to configure your window
|
|
manager. These vary from manager to manager, but for our examples we
|
|
will focus on the per-user files, and we are looking at FVWM2 in this
|
|
example, so you will modify the file <em>.fvwm2rc</em> in your home
|
|
directory.
|
|
|
|
<sect1>Basic FVWM2 Configuration
|
|
|
|
<p>Configuring your window manager resource file in earlier versions of
|
|
FVWM was a rather arduous process, because the order of the items in
|
|
the
|
|
file needed to be very particular, but that has relaxed quite a bit in
|
|
this version. To my knowledge, the only crucial part of the ordering is
|
|
the bindings for the menus, but we'll cover that a bit later. Your
|
|
FVWM2
|
|
installation should have come with an example resource file, and you
|
|
should be able to find that in
|
|
<em>/var/X11R6/lib/fvwm2/system.fvwm2rc</em>. This is the default
|
|
system-wide configuration file. A good idea would be to copy that file
|
|
into your home directory and call it <em>.fvwm2rc</em>. From that point
|
|
on, when FVWM2 starts up it will read the file in your home directory,
|
|
and ignore the system-wide configuration file.
|
|
|
|
Now that you've got a working, personalized copy of the window manager
|
|
resource file in your home directory, open it in your favorite text
|
|
editor, and take a look at it. If you're in X at the moment, you can
|
|
see
|
|
the correlation between the file and what you see on your desktop. Very
|
|
helpful indeed. Let's try changing something and see if we can make it
|
|
look a little better. Probably the first entry in your file (that is
|
|
not
|
|
followed by the <tt>#</tt> comment character) is the
|
|
<tt>WindowFont</tt> entry, followed by a very bizarre font name. If you
|
|
want to figure out how to set up the fonts and colors to their fullest,
|
|
skip ahead to the next section on X Fonts and Colors.
|
|
|
|
<sect1>Advanced FVWM2 Configuration
|
|
|
|
<p>Configuring FVWM2 can get incredibly subtle and complex. Take this
|
|
code snippet from the <bf>fvwm2gnome</bf> setup for the
|
|
<em>.fvwm2rc</em> file:
|
|
|
|
<tscreen><verb>
|
|
# import config files
|
|
|
|
Echo -Styles-
|
|
Read .fvwm2gnome/config/styles/app.styles
|
|
Read .fvwm2gnome/config/styles/window.styles
|
|
|
|
Echo -Buttons & Keys-
|
|
Read .fvwm2gnome/config/buttons.config
|
|
</verb></tscreen>
|
|
|
|
This is an example of a way to read in other configurations. In this
|
|
fashion you can modularize your <em>.fvwm2rc</em> -- not a bad idea,
|
|
considering how jumbled one huge configuration file can become. This
|
|
can make it easier to change and to debug, and it also makes it
|
|
easier to configure so-called <em>themes</em>, which we will cover in
|
|
a moment.
|
|
|
|
<sect1>FVWM2 Configuration Shortcuts
|
|
|
|
<p>A really neat way to configure your script for FVWM2 (and FVWM, and
|
|
<bf>bash</bf>, and a whole lot of other programs besides!) is to use
|
|
the <bf>Dotfile Generator</bf>, by Jesper K. Pedersen, available from
|
|
<url url="http://www.imada.ou.dk/˜blackie/dotfile/">. You will
|
|
need to have a recent version of <bf>Tcl/Tk</bf> installed (available
|
|
with most Linux distributions). This program starts with a
|
|
configuration preset, or takes the one you presently have, and allows
|
|
you to tweak it via many structured menus of options.
|
|
|
|
Be warned, however, for I advise learning how to set up your
|
|
configuration file yourself! Not only is this the <em>Unix Way</em>
|
|
(for what that's worth) but it's much easier to make small and
|
|
incremental changes to your <tt>.fvwm2rc</tt> file that way, and get
|
|
things exactly how you like them. Also, being a <bf>Tcl/Tk</bf>
|
|
program, it's a little slow. Nevertheless, if you want a painless way
|
|
to start with a decent configuration, this is definitely worth a
|
|
shot.
|
|
|
|
<sect1>FVWM2 Themes
|
|
|
|
<p>Among the many new possibilities of FVWM2 are something commonly
|
|
called <em>themes</em>. This basically means that you can switch
|
|
between a basic look for all of your windows on your desktop, on the
|
|
fly. Note that if you've made the distinction between the functions
|
|
of the window manager and the functions of the applications
|
|
themselves, you will realize that a window manager theme is not going
|
|
to affect the look and feel of the applications
|
|
themselves. Integrated toolkits such as KDE and GNOME do have this
|
|
capability, however, and the two might be used together very
|
|
effectively.
|
|
|
|
In order to generate a theme, you must roll up your sleeves and modify
|
|
your
|
|
<em>.fvwm2rc</em> file a little bit. Here's something I added near the
|
|
beginning of
|
|
my file, try putting it right after your <tt>Style</tt> definitions:
|
|
|
|
<tscreen><verb>
|
|
# Blue Theme
|
|
DestroyDecor Blue
|
|
AddToDecor Blue
|
|
+ WindowFont -b&h-lucida-bold-r-*-*-*-140-*-*-*-*-*-*
|
|
+ TitleStyle ActiveDown (Solid DarkSteelBlue)\
|
|
ActiveUp (Solid SteelBlue) Inactive (Solid Grey)
|
|
+ HilightColor white blue
|
|
+ ButtonStyle 1 -- UseBorderStyle
|
|
Style Blue UseDecor Blue, BorderWidth 5, HandleWidth 5,\
|
|
MWMborder, MWMbuttons
|
|
|
|
# Function to change all windows to a new style.
|
|
DestroyFunc ChangeStyle
|
|
AddToFunc ChangeStyle
|
|
+ "I" Style $0 $1
|
|
+ "I" Recapture
|
|
</verb></tscreen>
|
|
|
|
That's a lot to swallow, I know. Basically we're first defining a
|
|
theme called ``<tt>Blue</tt>,'' and you can use that first half as a
|
|
model to design other themes. Themes can describe many more features
|
|
than that, in fact, and can be quite remarkably different from one
|
|
another. Then we're defining a function to change all the windows to
|
|
a new style. Notice in both sections above that we destroy the object
|
|
before creating it. This is a good idea since you may well be
|
|
restarting FVWM2 a lot to try out your different styles, and this
|
|
makes it work a bit more smoothly.
|
|
|
|
The function call is needed as a generic interface to call the
|
|
definitions of the styles we have defined. Now we will make the menu
|
|
items to call them.
|
|
|
|
<tscreen><verb>
|
|
DestroyMenu "Themes"
|
|
AddToMenu "Themes"
|
|
+ "Choose a theme..." Title
|
|
+ "" Nop
|
|
+ "Blue" ChangeStyle "*" "UseStyle Blue"
|
|
+ "Mwm" ChangeStyle "*" "UseStyle Mwm"
|
|
+ "Flat" ChangeStyle "*" "UseStyle Flat"
|
|
</verb></tscreen>
|
|
|
|
We're being a little terse with the menu definition here, but there
|
|
should be a lot more in the sample file on your system. What we're
|
|
doing is calling the <tt>ChangeStyle</tt> function that we defined
|
|
above to change the style for all the windows on the screen to one of
|
|
the presets we defined above that. Notice, again, our good practice
|
|
in destroying the menu before creating it. Now if you restart FVWM2
|
|
(you should also have a menu option for that, hopefully!) you will
|
|
see a new <tt>Themes</tt> menu selection, and you should be able to
|
|
try out the different themes.
|
|
|
|
For more examples of FVWM2 Themes, visit <url
|
|
|
|
url="http://www.vis.colostate.edu/˜scriven/Linux/fvwm/index.html">.
|
|
|
|
<sect>Fonts and Colors
|
|
|
|
<p>There are a lot of tricks to the fonts and colors used in X. They
|
|
are not quite as simple as in some other systems, for instance, the
|
|
font is not just a one-word name. You specify these resources quite
|
|
explicitly, and it seems rather complex at first, but with a little
|
|
explanation you'll be a whiz in no time.
|
|
|
|
<sect1>Fonts Demystified
|
|
|
|
<p>The <em>X Logical Font Description</em> (``XLFD'') is the full name
|
|
for a
|
|
font. It consists of the following fields:
|
|
|
|
<itemize>
|
|
<item><tt>fndry</tt> - font foundry, the company or individual which
|
|
made
|
|
the font
|
|
<item><tt>fmly</tt> - font family, the popular nickname of the font
|
|
<item><tt>wght</tt> - font weight (bold, medium, etc.)
|
|
<item><tt>slant</tt> - font slant (italics, oblique, roman (normal),
|
|
etc.)
|
|
<item><tt>sWdth</tt> - font width (normal, condensed, extended, etc.)
|
|
<item><tt>adstyl</tt> - additional style (sans serif, serif, etc.)
|
|
<item><tt>pxlsz</tt> - pixel size, the number of pixels vertically in a
|
|
character
|
|
<item><tt>ptSz</tt> - approximate point size of the text (similar to
|
|
pxlsz)
|
|
<item><tt>resx</tt> - horizontal resolution, in dpi
|
|
<item><tt>resy</tt> - vertical resolution, in dpi
|
|
<item><tt>spc</tt> - spacing, only useful, apparently, in the
|
|
Schumacher fonts
|
|
<item><tt>avgWidth</tt> - average character width of the font
|
|
<item><tt>rgstry</tt> - the recognized registry that lists the font
|
|
<item><tt>encdng</tt> - nationality encoding
|
|
</itemize>
|
|
|
|
In light of this chaos, the program <bf>xfontsel</bf> (the default X
|
|
Window font selection program) will come in enormously useful to you.
|
|
Try
|
|
launching it right now. You will see a strange nothing helpful in the
|
|
main window, but try holding the left button down on the <tt>fndry</tt>
|
|
button. If all your fonts are in order, you will see a menu of
|
|
selections
|
|
such as <tt>adobe</tt> and <tt>b&h</tt> and <tt>bitstream</tt> and
|
|
so
|
|
forth. Select one such as <tt>b&h</tt> and you will notice that the
|
|
font in the lower window changes to something intelligible. This is
|
|
generally the way you will select fonts with this program, starting
|
|
from
|
|
the left, which is the most general selection, and moving toward the
|
|
right, to the more specific options. Selecting an option toward the
|
|
rightmost end will not make much sense before the foundry, for
|
|
instance,
|
|
is selected, because the options are generally ordered by their
|
|
dependence on each other.
|
|
|
|
When you go to select from the <tt>fmly</tt> selection, you will see
|
|
most
|
|
of the options greyed out, and only three remaining. That means that
|
|
these three are the only families of font made by this foundry. Some
|
|
families appear under more than one foundry, for instance, both
|
|
<em>Adobe</em> and <em>Bitstream</em> make a variation of the Courier
|
|
font. Now you can select the <tt>wght</tt>, and so forth. After you get
|
|
far enough you will have narrowed it down to the font that you want.
|
|
You
|
|
don't necessarily have to fill in all the options to choose a single
|
|
font,
|
|
there's not <em>that</em> many fonts on your system! The options that
|
|
you
|
|
do not select will be represented by a <tt>*</tt> indicating that any
|
|
option will do in that spot.
|
|
|
|
When you are happy with your font selection, you can hit the select
|
|
button, and your selection will be placed in the X clipboard, ready to
|
|
be
|
|
pasted into your document or whatever you are working on. For instance,
|
|
go to your <bf>xterm</bf> window and type in something like <tt>xterm
|
|
-font </tt> followed by an opening quotation mark. Then point to that
|
|
spot on your screen, and click your middle mouse button (or click both
|
|
the left and right, if you're middle-button impaired). This will paste
|
|
the selection from the clipboard, which should be the font you just
|
|
selected. Then enter the closing quote, and hit <tt>Enter</tt>. For
|
|
instance, a nice big <bf>xterm</bf> with a Courier font specified would
|
|
look like this: <tt>xterm -font
|
|
"-adobe-courier-medium-r-*-*-14-*-*-*-*-*-*-*"</tt>
|
|
A fresh <bf>xterm</bf>
|
|
should the pop up using the font that you selected.
|
|
|
|
The utility <bf>xfd</bf> is very helpful for examining a font. If you
|
|
launch it with a command line such as <tt>xfd -fn fixed</tt>, it will
|
|
show you the character set for the font, much like the keycaps utility
|
|
on
|
|
a Macintosh. Note that you can also limit the number of fonts that you
|
|
want <bf>xfontsel</bf> to display with the command line option
|
|
<em>-pattern</em>, followed by a quoted font specification, as
|
|
discussed
|
|
above.
|
|
|
|
<sect1>Font Aliases and Configuration
|
|
|
|
<p>Sometimes it gets tiresome to remember all of the long font names,
|
|
and
|
|
very impractical too. Luckily, it is not necessary to type in a hundred
|
|
keystrokes or so just to get the font name you want, for X provides
|
|
something called <em>font aliases</em>.
|
|
|
|
If you look in the directory
|
|
<em>/usr/X11R6/lib/fonts/misc/fonts.alias</em>,
|
|
you will find shortcut names for many of the fonts. For example,
|
|
<tt>8x16</tt> is listed as a shortcut for
|
|
<tt>-sony-fixed-medium-r-normal--16-120-100-100-c-80-iso8859-1</tt>,
|
|
and
|
|
anywhere you enter <tt>8x16</tt> as an X font resource or at a command
|
|
line
|
|
for a font name, the long version of the font will be substituted. The
|
|
<em>75dpi</em> and <em>100dpi</em> directories have similar aliases to
|
|
take
|
|
advantage of, on most systems the Lucida Sans font has a nice shortcut.
|
|
|
|
If you add fonts or aliases to your system, you will have to issue a few
|
|
commands (probably as root). If you add fonts, you will have to issue
|
|
the
|
|
following two commands (these are examples, you will have to put in the
|
|
correct directory, or perhaps leave it off altogether, to have your
|
|
fonts
|
|
re-read correctly.
|
|
|
|
<tscreen><verb>
|
|
mkfontdir /usr/lib/X11/fonts/misc
|
|
xset fp rehash
|
|
</verb></tscreen>
|
|
|
|
If you change the alias file for a font, you may only have to issue the
|
|
last command above, but it may be a good idea to issue them both, to be
|
|
sure.
|
|
With the <bf>xset</bf> command you can explicitly issue a font path you
|
|
wish
|
|
the server to use, you can delete a specific directory from your font
|
|
path,
|
|
see the man page for more information.
|
|
|
|
Another common problem is that some distributions (notably Red Hat
|
|
5.2, at the moment) come with the fonts configured in the wrong
|
|
order. If you take a look at your <em>/etc/XF86Config</em> (it may be
|
|
somewhere else in some distributions, unfortunately, and I'm not sure
|
|
where it is in Red Hat at the moment, so maybe <bf>locate</bf> it...)
|
|
Take a look at this file if your fonts are ugly in X (as in, very
|
|
difficult to read even at large sizes). You will see a bunch of
|
|
entries that look something like this:
|
|
|
|
<tscreen><verb>
|
|
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
|
|
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
|
|
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
|
|
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
|
|
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
|
|
</verb></tscreen>
|
|
|
|
The important thing to note here is that we have the unscaled
|
|
bitmapped fonts (the directories misc, 75dpi, 100dpi) before the
|
|
scaled fonts (such as Type1 and Speedo). Bitmapped fonts are
|
|
preferred for the X Server, because scaled fonts don't look very
|
|
pretty for common use, they're better for things like The Gimp or
|
|
Netscape, perhaps. You should also do a sanity check to see that
|
|
these directories all do, in fact exist, and if you have modified any
|
|
lately, you might need to (as root) go in and issue an <tt>mkfontdir
|
|
*</tt> command in the <bf>fonts</bf> directory.
|
|
|
|
Note that if you are running a more recent distribution, such as
|
|
one based on Red Hat 6.0 or later, you won't have to worry about this,
|
|
as the <em>xttfs</em> True Type font server is the default, and does
|
|
not use the path system to find your fonts.
|
|
|
|
<sect1>Using Type 1 Fonts in X
|
|
|
|
<p>The font types X generally accepts are of limited use, considering
|
|
that about the only place you'll find fonts of that kind used are in
|
|
the
|
|
X Window System itself, and unfortunately most media junkies and
|
|
fontaholics work in operating systems that prefer other formats.
|
|
<bf>Type 1 fonts</bf>, most commonly used in conjunction with
|
|
PostScript
|
|
document formats, can be found for free on the internet with
|
|
considerable ease. Try <url url="ftp://ftp.cdrom.com/pub/os2/fonts/">
|
|
for starters.
|
|
|
|
To make use of these fonts is not that difficult, and graphics programs
|
|
like <bf>GIMP</bf> will take advantage of them tremendously, and best
|
|
of all, the Linux X servers understand Type 1 fonts ``out of the box.''
|
|
To use them, first unpack the archive using the appropriate commands,
|
|
and put the fonts with a <tt>.pfb</tt> extension in
|
|
<em>/usr/X11R6/lib/X11/fonts/type1/</em> on your system. Then, add
|
|
mention of those fonts in the <tt>fonts.scale</tt> file in that
|
|
directory, using the format for the other fonts, already there. Then
|
|
save the file.
|
|
|
|
Now, you should be able to <tt>mkfontdir</tt> to tell the X server about
|
|
the updates, and then run <tt>xset fp rehash</tt> to re-read the font
|
|
path. If this doesn't work for you, you might have to restart X to see
|
|
the changes.
|
|
|
|
If you find yourself using Type 1 fonts a lot, and for things other than
|
|
just X (GhostScript, for instance, can handle this font format as
|
|
well), you'll want to check out the <bf>type1inst</bf> utility by James
|
|
Macnicol. This program can configure Type 1 fonts for GhostScript and
|
|
X, and it can also generate sample sheets for your fonts, and does most
|
|
of the work of configuration for you. This program can usually be found
|
|
at <url url="ftp://metalab.unc.edu/pub/Linux/X11/xutils/">.
|
|
|
|
<sect1>Using TrueType Fonts in X
|
|
|
|
<p>If you have been using an operating system such as Windows or the
|
|
MacOS, you may have lots of fonts sitting on your computer already that
|
|
are <bf>TrueType</bf> fonts. TrueType fonts are considered best on
|
|
smaller, low-resolution displays, such as your computer monitor, and
|
|
attempt to provide nice features like shading and antialiasing, making
|
|
your display look smoother. It is also really easy to find cheap
|
|
TrueType fonts in bulk, and CD's featuring upwards of 500 fonts in the
|
|
TrueType format are common in computer stores.
|
|
|
|
X does not understand TrueType fonts, and has no innate capability (at
|
|
present) to do so, and so it needs a separate program to do the
|
|
<em>font rendering</em> for it. There is a FreeType library to do
|
|
this, but if you just want to use them on your computer, all you will
|
|
need is a program called <bf>xfstt</bf>, the X font server for
|
|
TrueType. This program should be available at <url
|
|
url="ftp://metalab.unc.edu/pub/Linux/X11/fonts/">.
|
|
|
|
Installation is fairly straightforward. Extract the archive, and
|
|
<tt>make</tt> the file, and then <tt>make install</tt>. You may get a
|
|
few errors that don't make sense after the second command; ignore them.
|
|
What you need to do next is create a writable directory called
|
|
<em>/usr/ttfonts</em> and put some of your <tt>.ttf</tt> fonts there,
|
|
just to make sure it's going to work. Then synchronize the font server
|
|
with the command <tt>xfstt --sync</tt>.
|
|
|
|
If you got no errors there, run the font server in the background with
|
|
the command <tt>xfstt &</tt> and tell your X11 server about the font
|
|
service with the command <tt>xset fp+ unix/:7100</tt>. If you got no
|
|
errors, you should be able to run Netscape, the GIMP, even xfontsel,
|
|
and have those fonts available to you. Your biggest problem may be
|
|
finding the font you want, but that's not really a bad thing.
|
|
|
|
It has been brought to my attention that more recent versions of
|
|
xset require a slightly modified version of this command, because of
|
|
changes in the code of xset. If you are running a distribution based
|
|
on Red Hat 6.0 or later, or something equivalent, you will first want
|
|
to try <tt>xset fp+ unix/:7101</tt>.
|
|
|
|
If everything seems to be working fine, at this point you will want to
|
|
configure your system so that the fonts will be working when you start
|
|
X. If you are just starting X from the command line, this is easy.
|
|
All you have to do is add the two commands from the previous paragraph
|
|
to your <tt>.xinitrc</tt> file, in that order. When you next start X,
|
|
it should work just fine. If you are starting X via <bf>xdm</bf>, you
|
|
will need to add <tt>/usr/X11R6/bin/xfstt &</tt> to
|
|
<tt>/usr/X11R6/lib/X11/xdm/Xsetup_0</tt>. Got that? Then add <tt>xset
|
|
fp+ unix/:7100</tt> as well.
|
|
|
|
Bear in mind that the installation of a TrueType font server can be
|
|
tricky business. Remember that the order that you issue the above
|
|
commands is important. The font server must be started before X is
|
|
started, otherwise you will run into problems. Be sure to read
|
|
the FAQ file that came with the distribution, and the <tt>xfstt</tt>
|
|
man page too. Many newer Linux versions come with this already working,
|
|
so see if that's not already the case before worrying too much about
|
|
it.
|
|
|
|
<sect1>Colors
|
|
|
|
<p>Let's go back to our terminal window and try some more things. Try
|
|
opening an <bf>xterm</bf> with a command line like the following:
|
|
|
|
<tscreen><verb>
|
|
xterm -fg darkslateblue -bg red3 &
|
|
</verb></tscreen>
|
|
|
|
While that window may not be pretty, and you may not do much of your
|
|
best work in it, it demonstrates one interesting theme of X, the
|
|
names of the colors. While not very precise, this is a nice way to
|
|
remember the colors more easily than remembering a series of
|
|
hexadecimal numbers. Note that color names are never case-sensitive.
|
|
|
|
If you're interested in the gory details, or want to see the samples, or
|
|
even want to replace those silly color names with your own for some
|
|
strange reason, you can find the file listing all the colors with their
|
|
hexadecimal representation in <em>/usr/X11R6/lib/X11/rgb.txt</em> on
|
|
your
|
|
system. There are also some extremely useful utilities with names like
|
|
<bf>xcolorsel</bf> and such. They can be found in the usual locations,
|
|
on
|
|
<url url="http://metalab.unc.edu/pub/Linux/"> and elsewhere.
|
|
|
|
A more precise way of specifying colors is through the numerical
|
|
definition. This consists of a color space name and a set of values
|
|
in the following syntax:
|
|
|
|
<em><colorspace-name>:<value>/.../<value></em>
|
|
|
|
An RGB Device, which you will most likely be using, is specified with
|
|
the prefix "rgb:" and has the following syntax:
|
|
|
|
<em>rgb:<red>/<green>/<blue></em> , where
|
|
<color> is a 1 to 4 digit hexadecimal number.
|
|
|
|
As an example, you might represent the color <em>red</em> with
|
|
<tt>rgb:ffff/0/0</tt>. For backward compatibility, you can also
|
|
specify red with a syntax such as <tt>#ff0000</tt> or
|
|
<tt>#ffff00000000</tt>, and you will likely be seeing that
|
|
(older) syntax a lot.
|
|
|
|
<sect>The X Resources
|
|
|
|
<p>We will at this point consider some finer modifications to your
|
|
system. Configuring the window manager only gets you so far. The window
|
|
manager lets you customize everything that happens <em>outside</em> the
|
|
windows, the frames, the borders, the buttons, the desktop... but what
|
|
about making the <em>inside</em> of the windows pretty? The only way to
|
|
do
|
|
this is by modifying the <em>X Resources</em> for your system.
|
|
|
|
X Resources provide a mechanism for storing default values for program
|
|
resources and tailoring your windowing environment to your favored
|
|
look and feel. Resources are specified as text strings that are read
|
|
in from various places when an application is run. Program components
|
|
are named in a hierarchical fashion, with each object in the
|
|
hierarchy identified by a class as well as an instance name. At the
|
|
top level of the hierarchy is the class and instance name of the
|
|
application itself. By convention, the class name of the application
|
|
is the same as the program name, but with the first letter
|
|
capitalized (e.g. Bitmap or Emacs) although some programs that begin
|
|
with the letter ``X'' also capitalize the second letter for
|
|
historical reasons (e.g. XTerm).
|
|
|
|
<sect1>X Resources: The Basics
|
|
|
|
<p>Let's try a few examples to ease you into the world of
|
|
resources. Start by opening an xterm window. Most likely you have one
|
|
open already, can open one with a menu selection, or may wish to
|
|
backtrack a bit in this document to get your bearings! Type something
|
|
like this into the xterm window:
|
|
|
|
<tscreen><verb>
|
|
xterm -background blue &
|
|
</verb></tscreen>
|
|
|
|
This command should have resulted in another xterm window popping up
|
|
on your screen, but this time with a blue background. ``Wow,'' you say,
|
|
``that's amazing!'' Yes, indeed it is.
|
|
|
|
We'll need a little more background for our next example. Type exit in
|
|
that xterm (which will close that window) and go back to the original
|
|
window that you typed that command in. Try this: hold the Ctrl key
|
|
and then hold the left mouse button. Now try that with the middle
|
|
mouse button. Now the right. All xterm windows give you options to
|
|
try while they are running. With the right button, for instance, you
|
|
can change the font of the window. Notice the color of these
|
|
menus. Now try this example:
|
|
|
|
<tscreen><verb>
|
|
xterm -xrm 'xterm*fontMenu*background: green' &
|
|
</verb></tscreen>
|
|
|
|
This time, it just looks like a normal xterm window. But if you try
|
|
holding Ctrl and the right mouse button in that window, you will see
|
|
that
|
|
this menu (the ``fontMenu'' mentioned in the above example) is green.
|
|
What
|
|
just happened? If you look at the man page for <bf>xterm</bf>, you
|
|
will
|
|
see many command-line options, such as <em>-background</em> or
|
|
<em>-font</em>, that you can set when you launch any given window in X,
|
|
listed after the options just for <bf>xterm</bf> windows. These
|
|
particular options are called <em>X Toolkit Options</em>, and they
|
|
apply
|
|
to just about anything in X.
|
|
|
|
<sect1>Inside The X Resource Database With <em>editres</em>
|
|
|
|
<p>To really get inside the resources of X, we need to run
|
|
<bf>editres</bf>. Go ahead
|
|
and launch it (and a sample program to play with) now:
|
|
|
|
<tscreen><verb>
|
|
xclock &
|
|
editres &
|
|
</verb></tscreen>
|
|
|
|
Probably you will see a simple clock, and the rather innocent looking,
|
|
mostly-blank window of <bf>editres</bf>. The main window is showing us
|
|
the resource tree of any given window on our desktop, and upon program
|
|
launch, there is none. So let's give it one. Hold down the left button
|
|
on
|
|
the Commands menu, and select Get Tree. In the top of the window will
|
|
appear <tt>Click the mouse pointer on any toolkit client</tt>. This
|
|
message is more than it seems, and it is a hint to us that not all X
|
|
applications are toolkit clients (though most of the basic ones are,
|
|
and
|
|
the program will usually tell us if it is not in the manual page). The
|
|
mouse cursor will turn to a crosshair, and wait for you to click on
|
|
another window.
|
|
|
|
For this example, let's first click on the <bf>xclock</bf>. You will
|
|
see a couple things appear in the <bf>editres</bf> window. These are
|
|
the configurable branches that the toolkit sees. Click on the bottom
|
|
right one (clock). It should invert. Now select ``Show Resource Box''
|
|
from the ``Commands'' menu. You will see another window pop up, with
|
|
the heading ".xclock.clock.unknown". Bingo!
|
|
|
|
>From here you can toy with the configuration options of the main
|
|
<bf>xclock</bf> window. First, click on ``Set Save File'' at the
|
|
bottom, and put in a filename such as
|
|
<em>/home/yourname/resources</em>, to indicate that you're testing
|
|
some of the resources here. Now click on ``foreground'' and put in
|
|
``blue'' next to the ``Enter Resource Value:'' prompt. Then hit
|
|
``Apply''
|
|
at the bottom. The minute notches around the clock should turn
|
|
blue. Go to ``background'' and enter ``navajowhite'' (or whatever color
|
|
you prefer). Then apply that. As you can see, we can configure the
|
|
whole window just fine this way. But if you were to try launching
|
|
another <bf>xclock</bf>, it would appear just as this one appeared
|
|
before any changes. We need to save these changes.
|
|
|
|
Click ``Save'' and then ``Popdown Resource Box'' (a fancy name indeed
|
|
for
|
|
the ``Close'' function!). If you view the file you just created
|
|
(<em>cat /home/yourname/resources</em> perhaps) you will see all
|
|
those resources spelled out, in correct X Toolkit format, for your
|
|
convenience. But that does us little good, for if you try launching
|
|
another <bf>xclock</bf>, it will still look Plain Jane. So here is
|
|
the last and final step in loading in your resources:
|
|
|
|
<tscreen><verb>
|
|
xrdb -merge /home/yourname/resources
|
|
</verb></tscreen>
|
|
|
|
This command <em>merges</em> the resources we just wrote into the <em>X
|
|
Resource Database</em> (<bf>xrdb</bf>) for your session of X Window.
|
|
That
|
|
means that for all future invocations of the X applications we
|
|
modified,
|
|
our changes will take place, and remain binding. So if you run another
|
|
<bf>xclock</bf>, it will look as nice as you have just now set it up,
|
|
every time you run it. Mind you, <bf>xrdb</bf> is a complex program,
|
|
and
|
|
you may want to have a look at the man page before moving on, or
|
|
playing
|
|
around with it some more. If you added the modification to
|
|
<tt>.xinitrc</tt> listed earlier in this document, to load the
|
|
resources
|
|
automatically on X startup, you should only have to worry about the
|
|
<bf>xrdb</bf> command when you make changes during your X session.
|
|
|
|
<sect1>The Anatomy of X Resources
|
|
|
|
<p>As you can see we have stumbled across a plethora of configuration
|
|
options here. This method of configuring X, as has been stated,
|
|
offers nearly limitless possibilities, and an equivalent amount of
|
|
confusion. To get some picture of the scope of the resources in just
|
|
the X Toolkit Intrinsics alone, run the program <bf>viewres</bf>, and
|
|
play around with it a bit. This program graphically displays the tree
|
|
of resources in the <em>Xt Library</em>.
|
|
|
|
If you read the manual page for <bf>X</bf>, you will find a rather
|
|
obscure definition of the exact syntax for defining resources it
|
|
understands. We can simplify this quite a bit and break it down into
|
|
this essential syntax definition:
|
|
|
|
<em><program><binding><widget><binding><widget><...><resource>:<value>
|
|
</em>
|
|
|
|
That doesn't really seem that simple, actually. Well, let's define
|
|
some things about what has just been said, and it will all start to
|
|
make sense after all. You can peek ahead to the examples in the next
|
|
section as you read along, if you wish.
|
|
|
|
The <em>program</em> in this definition is the invocation of an
|
|
application in the resource database. This would be <tt>XTerm</tt>
|
|
for an invocation of <bf>xterm</bf>, <tt>emacs</tt> for an invocation
|
|
of the <bf>emacs</bf> text editor, or a user-defined name that was
|
|
given when the applications was launched with the <bf>-name</bf>
|
|
command line option. In this way you can define separate resources
|
|
for <bf>xterm</bf>s which will be used in different ways. Which is
|
|
pretty cool, really.
|
|
|
|
The <em>binding</em> can be one of two characters to separate the
|
|
widgets and such. If you use a <tt>.</tt> (period), you get a
|
|
<em>tight binding</em>, which means that one widget is directly above
|
|
or below the other in the widget hierarchy. This also has the highest
|
|
precedence of the specification methods. If you use a <tt>*</tt>
|
|
(asterisk), you get a so-called <em>loose binding</em>, and you will
|
|
skip any number of widgets in the hierarchy, and it will attempt to
|
|
match the next possible widget defined.
|
|
|
|
The <em>widget</em> entries are items in the widget tree, in order of
|
|
most-specific to least-specific, that they appear in the widget tree,
|
|
visible with <bf>editres</bf>. Any single widget entry can also be
|
|
replaced with a <tt>?</tt> (question mark) to skip a single widget
|
|
definition, and match any possible widget item.
|
|
|
|
The <em>resource</em> item must be specified, and cannot be replaced
|
|
with
|
|
the <tt>?</tt> character. This is the most-specific item in the
|
|
hierarchy, and usually contains items like the actual color to define,
|
|
actual font to define, and so forth. In fact, everything else before
|
|
the
|
|
resource in this definition can be left out and replaced with a single
|
|
asterisk, but the actual resource to define must be present. If you
|
|
just
|
|
put an asterisk and the most-specific resource name, such as
|
|
<tt>*background: blue</tt>, X will attempt to define that resource
|
|
globally, for all its clients, if possible.
|
|
|
|
Following the colon is the <em>value</em> entry. This entry defines
|
|
what the resource will be set to, such as a font name or color
|
|
value. The value can be specified (depending on context) as a
|
|
boolean, numeric, or text data type. The value entry, also, cannot be
|
|
omitted in a valid resource definition.
|
|
|
|
<sect1>Making Your Changes Last With <em>.Xdefaults</em>
|
|
|
|
<p>There is a magic file you can put in your home directory called
|
|
<em>.Xdefaults</em>. If you copy the lines in the resources file from
|
|
the
|
|
last example into the <em>.Xdefaults</em> in your home directory, you
|
|
will never have to configure <bf>xclock</bf> again! While this might
|
|
not
|
|
be the finest example of its utility, it makes its point. This file can
|
|
be crammed full of every option you prefer for every type of program
|
|
you
|
|
run in X, and if you take proper care of it, you can still easily go
|
|
back
|
|
and make slight changes when you need to. But making lots of changes,
|
|
and
|
|
hunting down lots of subtle resources using <bf>editres</bf> can be an
|
|
extremely tiring and painstaking procedure. Indeed, sometimes that's
|
|
too
|
|
much work, and most of these resources are already waiting for you,
|
|
neat
|
|
and orderly, grouped by program, on your system.
|
|
|
|
In the directory <em>/var/X11R6/lib/app-defaults</em> you will find a
|
|
great many files, all named after an X Toolkit program. If you
|
|
examine these files you will find that they contain a great many
|
|
configuration options for each one, and I do mean a great many! You
|
|
would not want all of these options from all of these files in your
|
|
<em>.Xdefaults</em> file, that would be quite tiresome to deal
|
|
with. These are the defaults, and it is from these that you can
|
|
decide what you would like to see changed for your particular
|
|
configuration.
|
|
|
|
The following are some samples from my <em>.Xdefaults</em> file. Notice
|
|
a
|
|
few things we have not yet mentioned about the resource definition
|
|
files. If a line begins with <tt>!</tt> (exclamation point), it is
|
|
considered a comment, and the rest of the line is ignored. If the line
|
|
begins with <tt>#include <em>filename</em></tt>, that line is an
|
|
<em>include directive</em>, and at that point in the resources another
|
|
file will be merged, when it is loaded. This can help keep your
|
|
resource
|
|
files from becoming too bloated. And here are some examples:
|
|
|
|
<tscreen><verb>
|
|
! Default resources for me@localhost xterms
|
|
! start with the generic, move to the specific...
|
|
*Dialog*Text*font: -b&h-lucida-medium-r-*-*-12-*-*-*-*-*-*-*
|
|
*dialog*value*background: white
|
|
*Dialog*Label*font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*
|
|
*MenuButton*font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
|
|
*MenuButton*background: grey80
|
|
*MenuButton*foreground: black
|
|
*Label.font: -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*
|
|
*Label*shadowWidth: 1
|
|
*SmeBSB.font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*
|
|
*SimpleMenu*font: -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*
|
|
*OptionMenu*font: -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*
|
|
*Command.font: -linotype-helvetica-bold-r-narrow-*-12-*-*-*-*-*-*-*
|
|
*commandBox*font: -b&h-lucida-bold-r-*-*-12-*-*-*-*-*-*-*
|
|
*Toggle.font: -adobe-helvetica-bold-o-*-*-12-*-*-*-*-*-*-*
|
|
*Form.background: grey70
|
|
*TransientShell*Dialog.background: grey70
|
|
*Scrollbar.Foreground: grey80
|
|
*Scrollbar.Background: grey50
|
|
*Scrollbar*cursorName: top_left_arrow
|
|
*Scrollbar*width: 16
|
|
*shapeStyle: Rectangle
|
|
*XlwMenu.shadowThickness: 1
|
|
*shadowWidth: 1
|
|
|
|
! xterm stuff
|
|
xterm*scrollbar.background: grey40
|
|
xterm*foreground: grey90
|
|
xterm*background: grey25
|
|
xterm*cursorColor: white
|
|
xterm*visualbell: on
|
|
! rxvt stuff (a quicker, better xterm)
|
|
rxvt*color12: steelblue
|
|
rxvt*color15: white
|
|
rxvt*color9: rgb:ff/7f/5f
|
|
rxvt*foreground: grey90
|
|
rxvt*background: grey10
|
|
rxvt*cursorColor: white
|
|
rxvt*font: lucidasanstypewriter-12
|
|
rxvt*loginShell: false
|
|
rxvt*saveLines: 1024
|
|
rxvt*title: shell
|
|
rxvt*geometry: 80x25
|
|
! Make Xman just a little bit more sane
|
|
xman*topBox: false
|
|
xman*background: lightsteelblue
|
|
xman*foreground: black
|
|
! xcalc is too bland by default...
|
|
xcalc*Command.font: -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
|
|
xcalc*customization: -color
|
|
! Disallow the <blink> tag in Netscape
|
|
Netscape*blinkingEnabled: False
|
|
|
|
! Merge other resources (example)
|
|
# include $HOME/.otherXresources
|
|
</verb></tscreen>
|
|
|
|
One word of warning with regard to X resources, for KDE users. There's
|
|
a
|
|
setting in the control panel which will cause all your X Resources to
|
|
be
|
|
overwritten in your applications. This can be a really nice feature,
|
|
but
|
|
it can also be an annoyance if you have painstakingly configured your
|
|
resources. Open the control panel and find the ``Fonts etc.''
|
|
section. There's an option to ``Apply style to non-KDE apps''. If you
|
|
turn this on, all your programs will adopt the look and feel configured
|
|
by KDE (you may need to restart X to notice this). If you leave this
|
|
option turned off, your resources will remain as you have configured
|
|
them.
|
|
|
|
<sect1>Your Own User Resource Directory
|
|
|
|
<p>You can also create a directory of resource files, just like the
|
|
system-wide <em>app-defaults</em> directory mentioned above, with one
|
|
file
|
|
per program. Just create the directory (for our example we'll use
|
|
app-defaults under your home directory,) and then set the environment
|
|
variable <tt>XAPPLRESDIR</tt> to point to it. A good place to set this
|
|
variable would be in the beginning of your <tt>.xinitrc</tt> file, for
|
|
example, put in the line <tt>export XAPPLRESDIR=$HOME/app-defaults</tt>
|
|
(if
|
|
your files are going to be in an <em>app-defaults</em> directory under
|
|
your
|
|
home directory).
|
|
|
|
Now, whenever you start an X program, this directory will be searched
|
|
for
|
|
a file with the same name as the resource name of the program, just
|
|
like
|
|
the system-wide directory. This is the <em>client name</em> that you
|
|
used in <tt>.Xdefaults</tt> files.
|
|
|
|
For example, a file called <em>XTerm</em> could contain the line
|
|
<tt>*background: gold</tt>, and all your <bf>xterm</bf>s would, by
|
|
default,
|
|
come up with a gold background. This is a nice alternative to a single
|
|
<tt>.Xdefaults</tt> file, and makes it more clear when trying to decide
|
|
which settings to configure later on, and to find the ones for a
|
|
certain
|
|
program. There are still uses for the <tt>.Xdefaults</tt>, though.
|
|
It's
|
|
useful for setting resources not bound to a single program, like
|
|
modifications that you would make to turn all of a certain kind of
|
|
button
|
|
blue, regardless of the application.
|
|
|
|
<sect>Clients and Application Tips
|
|
|
|
<p>We have covered a few clients in X, and this section will cover some
|
|
more. We will limit our discussion here to the most basic and important
|
|
core items, those which come with X or you are likely to find yourself
|
|
using with X. If you have installed an integrated desktop environment
|
|
such
|
|
as KDE or GNOME, you will have many others to choose from which likely
|
|
perform many of the same functions. However, it is important to know
|
|
about
|
|
and understand many of the fundamental programs in X, because they can
|
|
be
|
|
very useful for working with your environment and such. Also X offers
|
|
many new options that even your normal console applications can take
|
|
advantage of.
|
|
|
|
<sect1>Screen Savers for X
|
|
|
|
<p>A common feature of many operating systems is the ability to blank
|
|
the screen after a specified amount of time, and optionally display
|
|
some sort of nifty graphics demo thing, a screen saver. There are a
|
|
couple ways to do that in X, too.
|
|
|
|
The most basic way to use this feature is by putting a command in your
|
|
<tt>.xinitrc</tt> startup file such as <tt>xset dpms 2400 3600
|
|
4800</tt>. The <bf>xset</bf> program can configure the screen saving
|
|
features of the X server, not to be confused with the screen blanking
|
|
that the kernel does when you are at the text console. With the
|
|
<tt>dpms</tt> option, X can use the power saving features of your
|
|
monitor as well. The first option configures how many seconds before
|
|
the screen blanks, the second option is how many seconds before the
|
|
power saving feature starts, and the third option is for the
|
|
"off" mode. Turning on an option implicitly enables the
|
|
feature, setting a feature to zero explicitly disables it.
|
|
|
|
Many Linux distributions come with <bf>xlock</bf> preinstalled, or as an
|
|
option. This is a pretty basic and fairly nice screen saver. If you
|
|
run it with the <tt>-nolock</tt> option, you can see some of the modes
|
|
that it offers, and if you leave that option off, it will ask you for a
|
|
password when you move the mouse or press a key, as a security feature.
|
|
Note that this is no real security, for at a Linux console a user could
|
|
restart the computer or just drop out of X with a combination of
|
|
keystrokes. The last method can be disabled, however, and if you are
|
|
using <bf>xdm</bf>, it will offer as much security as your login, so it
|
|
may be that only rebooting will let someone in.
|
|
|
|
A newer and better program is <bf>xscreensaver</bf> by Jamie Zawinski.
|
|
This program offers a great many niceties, for instance, it can run its
|
|
processes at a nicer priority level, lessening the load to the system
|
|
while it's running, and it automatically detects when the screen has
|
|
been
|
|
powered down by <bf>xset</bf> and doesn't waste processor time. Also,
|
|
all of the graphics routines it calls are modular demos, and you can
|
|
add routines without upgrading the whole package, and it can also call
|
|
other programs, such as <tt>xearth</tt> or <tt>xdaliclock</tt>, as
|
|
modules.
|
|
|
|
The latest version of <bf>xscreensaver</bf> can be found at <url
|
|
url="http://www.jwz.org/xscreensaver/">. Once you get it installed and
|
|
ready to go, here are some nice additions you might wish to add to your
|
|
<tt>.Xdefaults</tt> file:
|
|
|
|
<tscreen><verb>
|
|
!!! some XScreenSaver sample defaults
|
|
! Time out after 3 minutes, cycle mode after each 2
|
|
xscreensaver.timeout: 3
|
|
xscreensaver.cycle: 2
|
|
! Run very low priority, and fade between modes
|
|
xscreensaver.nice: 12
|
|
xscreensaver.fadeSeconds: 2
|
|
</verb></tscreen>
|
|
|
|
<sect1>Emacs and XEmacs
|
|
|
|
<p>If you are a fan of the text editor <bf>EMACS</bf>, or just someone
|
|
who uses it a lot, you will find your work even easier in X Windows.
|
|
If you have not tried XEmacs, you may want to get it for use in X.
|
|
There are features in XEmacs that are nice even if you are not in X,
|
|
for instance, your text can be colored to match the markup style you
|
|
are editing automatically.
|
|
You should give the following modification to your
|
|
<tt>.emacs</tt> file a shot, and read the info pages for more options.
|
|
Also look for an option to edit faces in the menus.
|
|
|
|
<tscreen><verb>
|
|
(global-font-lock-mode t)
|
|
(setq font-lock-maximum-decoration t)
|
|
</verb></tscreen>
|
|
|
|
<sect1>Some Useful Programs and Tricks
|
|
|
|
<p><descrip>
|
|
|
|
<tag>appres</tag>The appres program prints the resources seen by an
|
|
application (or sub-hierarchy of an application) with the specified
|
|
class and instance names. It can be used to determine which
|
|
resources a particular program will load. Useful for debugging your
|
|
X defaults and such.
|
|
|
|
<tag>rclock</tag>Many distributions come with this nice replacement
|
|
for xclock, which saves memory, alerts you when your mail comes, and
|
|
can pop up reminder messages and launch programs. The
|
|
<bf>Battery-Powered
|
|
Mini-HOWTO</bf> contains instructions on patching this utility to show
|
|
how much battery is left in your laptop, too.
|
|
|
|
<tag>rxvt</tag>A nice replacement for xterm - uses less memory, works
|
|
faster, lets you put in a background pixmap, and lets you switch
|
|
fonts with keyboard hotkeys, rather than menus.
|
|
|
|
<tag>xcpustate</tag>Displays CPU state (idle, nice, system, kernel)
|
|
statistics, as well as Ethernet information.
|
|
|
|
<tag>xearth</tag>Display the earth on your root window, many options
|
|
for display available. <bf>Xscreensaver</bf> can use this as a
|
|
screensaver module, for maximum fun.
|
|
|
|
<tag>xfig</tag>A vector drawing program, particularly useful for
|
|
charts and documentation. Quite useful but hard to get the hang of at
|
|
first.
|
|
|
|
<tag>xfontsel</tag>Font selection utility for X Window. Try the command
|
|
<tt>xterm -fn `xfontsel -print` &</tt> to pick a font and then open
|
|
the
|
|
xterm window using that font.
|
|
|
|
<tag>xload</tag>Monitor your memory usage with a moving graph or the
|
|
lights on your keyboard! If you use Window Maker, look for
|
|
<bf>wmmon</bf> to do the same, but prettier.
|
|
|
|
<tag>xmag</tag>A magnifying glass for X, with a couple other useful
|
|
features.
|
|
|
|
<tag>xman</tag>Manual page browser for X. If the little box it starts
|
|
with gets annoying, launch it with the <em>-notopbox</em> option.
|
|
|
|
<tag>xmodmap</tag>Edit and display the keyboard modifier map and
|
|
keymap table that are used by client applications to convert event
|
|
keycodes into keysyms, usually run from user's startup script. An
|
|
example
|
|
was given earlier in this document, see the man pages for more info.
|
|
|
|
<tag>xpaint</tag>Basic bitmap painting program, for any real work you
|
|
should grab <url url="http://www.gimp.org/" name="GIMP">.
|
|
|
|
<tag>xset</tag>User preference utility for X. You can change all sorts
|
|
of stuff with this. For instance, <tt>xset s 600</tt> sets the screen
|
|
to blank after ten minutes.
|
|
|
|
<tag>xsetroot</tag>Change the color of your desktop. If you have a
|
|
color
|
|
selector program like <bf>xcolorsel</bf> installed, try a command like
|
|
<tt>xsetroot -solid `xcolorsel`</tt> to pick a color and set your
|
|
desktop
|
|
to that color.
|
|
|
|
<tag>xwininfo</tag>You can run this program and click on any window
|
|
for lots of useful information about it.
|
|
|
|
<tag>The Intellimouse</tag>You can use the Intellimouse in X with a
|
|
great many applications. There is an excellent resource page located
|
|
at <url url="http://www.inria.fr/koala/colas/mouse-wheel-scroll/">.
|
|
|
|
</descrip>
|
|
|
|
<sect>Advanced X Usage
|
|
|
|
<p>There's a lot to learn about X, a lot of info buried in the
|
|
inscrutible land of man pages, a lot of things most folks don't bother
|
|
reading. Some if it is rather important, and it's easy to make some
|
|
mistakes, and get completely stuck. It can be much harder to build a
|
|
program in X, or check the security of X, or many other things, because
|
|
X and all the things that run on top of it are so vast. This section
|
|
is an attempt to cover some of the more advanced and confusing
|
|
situations that may arise.
|
|
|
|
<sect1>Libraries and Compiling X Applications
|
|
|
|
<p>Sooner or later you will have to deal with compiling applications of
|
|
your own. Later, if you just installed a nice distribution of linux,
|
|
and
|
|
are happy with what you've got, sooner, if you're the kind of person
|
|
who
|
|
likes to tinker and install. Remember, this is a privilege, not a
|
|
right,
|
|
so have fun with it!
|
|
|
|
First, a few pointers on compiling programs with X. Many newer
|
|
applications, GNU applictions in particular, come with a script in the
|
|
root directory called <bf>configure</bf>. This assumes of course that
|
|
you've extracted the file and are in the directory. This program should
|
|
be run as <tt>./configure</tt>, and will automatically detect many
|
|
things
|
|
about your system. Afterwards, simply running <tt>make</tt> and
|
|
perhaps
|
|
becoming root and running <tt>make install</tt> will get the program up
|
|
on your system.
|
|
|
|
You may have to do a little more tinkering if you do not have a
|
|
<bf>configure</bf> script available. Many X programs require you to run
|
|
a
|
|
program to make the <bf>Makefile</bf>, called <tt>xmkmf</tt>. If you
|
|
don't see a <bf>Makefile</bf> in your directory, this will sometimes
|
|
work, and will generate a suitable configuration for you, and you'll be
|
|
ready to <tt>make</tt> from there.
|
|
|
|
Sometimes you will have run the <bf>configure</bf> script, and have been
|
|
warned that you lack a library that would be helpful or necessary to
|
|
properly use that application. For instance, I recently installed the
|
|
<bf>xscreensaver</bf> application, and found that it would support
|
|
several 3D modes if the <bf>Mesa</bf> library was installed. If you run
|
|
into this situation and want that library installed, the first thing
|
|
you
|
|
should do is check the CD or installation media for your Linux
|
|
distribution to see if you have the library on there. That may save
|
|
you
|
|
lots of trouble trying to compile the library.
|
|
|
|
Once you get a library compiled and installed and ready to use, you can
|
|
go
|
|
back to the directory you were installing your X program from, remove
|
|
the
|
|
<tt>config.cache</tt> file, and run the <bf>configure</bf> script
|
|
again. Hopefully it will find the library you have installed. Sometimes
|
|
it does not, and you have to tinker to get it working. This happens
|
|
occasionally with libraries you download off the net, that do not
|
|
adequately support the Linux File System Standard (most do, however).
|
|
|
|
<sect1>Basic X Security
|
|
|
|
<p>It has often been said that X has a very simple security model: All
|
|
or Nothing. This is not much of an exaggeration at all. X can be
|
|
configured to use somewhat sophisticated security, via encryption,
|
|
but that is beyond the scope of this HOWTO (for the present). It is
|
|
assumed that the user is not using any encryption for this
|
|
discussion.
|
|
|
|
First of all, you should try and follow some simple rules when you're
|
|
compiling programs for X (or for any reason, really). Try not to
|
|
become root any more than necessary. Configure your programs as a
|
|
normal user with the <tt>./configure && make</tt> (or just
|
|
<tt>make</tt> if there's no configure script), and then issue the
|
|
single command to install it as root by typing <tt>su -c "make
|
|
install"</tt>, and then typing in the root password at the
|
|
prompt. That way you won't have to be logged in as root, you can
|
|
just issue a single command, and you're back to your normal user
|
|
prompt. This is a smart, safe way to install software.
|
|
|
|
The next thing to think about is running X software as root. Realize
|
|
that X is more or less inherently insecure, and if your primary
|
|
concern for a particular Linux box is security, you really don't want
|
|
to install X at all! Having said that, some folks want to run nice
|
|
fancy configuration programs or package management tools in X. I
|
|
<bf>do not</bf> recommend starting X as root. It's just not a good
|
|
idea. There's much, much better ways to do these things!
|
|
|
|
If you want to run an X application as root, just log in under your
|
|
normal user account, and launch it from there. As I mentioned above,
|
|
you don't want to be logged in as root any more than absolutely
|
|
necessary. The root user has the ability to do just about anything on
|
|
the system, including about a million ways to destroy it
|
|
completely. Simply go to your <bf>xterm</bf> or such application and
|
|
type in a command such as <tt>su -c "glint -display
|
|
:0.0"</tt> to launch the window on your desktop. Now you have a
|
|
single window running as root, and not the whole desktop. You might
|
|
also want to consider using the complete pathname to the program
|
|
you're running as root, for extra security.
|
|
|
|
Tomasz Motylewski also offers the following tip for <bf>ssh</bf> and
|
|
<bf>ssh-agent</bf> lovers. If you put the following in your
|
|
<em>/usr/X11R6/lib/xinit/Xclients</em> file:
|
|
|
|
<tscreen><verb>
|
|
eval "exec ssh-agent fvwm${FVWMVER} ${FVWMOPTIONS}" >
|
|
"$HOME"/.FVWM${FVWMVER}-errors 2>&
|
|
</verb></tscreen>
|
|
|
|
That is, replace your standard <tt>fvwm${FVWMVER} ${FVWMOPTIONS}</tt>
|
|
command with the preceeding. That is to start your window manager as a
|
|
child of <bf>ssh-agent</bf>. Then you should try <tt>ssh-add <
|
|
/dev/null</tt> from an <bf>xterm</bf> session (if you have your
|
|
identity RSA key in the file <em>~/.ssh/identity</em>). If this works
|
|
for you then you should find that you are authenticated in all your X
|
|
windows.
|
|
|
|
It should be noted that this is a suggestion from the reader, and the
|
|
author has no experience with <bf>ssh</bf> at the present, so proceed
|
|
at
|
|
your own risk! More recent Linux distributions allow for setting up
|
|
<bf>ssh</bf> automatically, via <tt>setup</tt> or something similar,
|
|
which means that you may not have to worry too much about setting it
|
|
up, just understanding how it works.
|
|
|
|
<sect1>More About X Authority
|
|
|
|
<p>The mysteries of user authentication in X are a prime example of
|
|
the security problems many users encounter with X. Tomasz Motylewski
|
|
relates the following story, which sums up the situation quite well.
|
|
|
|
``...in the default XFree86 configuration X session started by
|
|
``startx''
|
|
accepts commands from everyone
|
|
connecting from localhost. If you start X as user1 and you have user2
|
|
remotely logged in, user2 has full access to your keyboard and desktop
|
|
(once
|
|
my friend played a joke on me and put in his cron commands dumping my X
|
|
desktop image and sending to him every hour). I did not notice it for 2
|
|
weeks!''
|
|
|
|
Well that's not exactly a good thing, but unfortunately many readers
|
|
have this exact problem. Tomasz goes on to point out that if you use
|
|
<bf>xdm</bf> to log in (as detailed earlier in this HOWTO), rather than
|
|
just running <bf>startx</bf>, this won't be a problem because access is
|
|
controlled by the <bf>xauth</bf> program. By issuing the
|
|
<bf>xhost</bf> command, you can see who is allowed access to your X
|
|
session. Any user from the hosts that are listed in the output of the
|
|
<bf>xhost</bf> command is authorized full access to your screen and
|
|
keyboard.
|
|
|
|
If you want to start your X server in a secure fashion from the command
|
|
line, you will need to make the following modifications to your
|
|
configuration. First, modify <bf>startx</bf> (probably at
|
|
<em>/usr/X11R6/bin/startx</em>) by changing the last line <tt>xinit
|
|
$clientargs -- $serverargs</tt> to read <tt>exec xinit $clientargs --
|
|
$serverargs -auth ~/.Xauthority</tt>.
|
|
|
|
Then you will also need to edit your <bf>.xinitrc</bf> or your
|
|
system-wide <em>/usr/X11R6/lib/xinit/xinitrc</em> (whichever you are
|
|
actually using, probably the one in your home directory), by adding
|
|
this at the beginning of the file:
|
|
|
|
<tscreen><verb>
|
|
# if Xserver has been run with "-auth ~/.Xauthority" option
|
|
this will
|
|
# prevent other users on your machine to connect to your X server
|
|
# unless you allow it explicitly using xhost +host or give them
|
|
# your ~/.Xauthority file.
|
|
xauth generate $DISPLAY . trusted
|
|
</verb></tscreen>
|
|
|
|
Always be sure and run <bf>xhost</bf> to check the security that you
|
|
have configured, to make sure everything is working correctly.
|
|
|
|
<sect>Bibliography and Other Resources
|
|
|
|
<p>There is lots of information on X Window to be found, on your
|
|
computer right now, on the Internet, and in some excellent books
|
|
available at your favorite bookseller. Give some of the following
|
|
resources a try, they have been extremely helpful to the author, and
|
|
can be extremely helpful to you, too.
|
|
|
|
<itemize>
|
|
|
|
<item>Check the <url url="http://metalab.unc.edu/LDP" name="Linux
|
|
Documentation Project"> website for a lot more documentation on Linux,
|
|
X,
|
|
and related items.
|
|
|
|
<item><url url="http://www.x11.org/">is
|
|
sort of a clearinghouse for all things X.
|
|
|
|
<item><url url="http://www.themes.org/">is a headquarters for themes for
|
|
various window managers.
|
|
|
|
<item>The X Consortium's web site is <url url="http://www.x.org/">... or
|
|
perhaps it's moved to <url url="http://www.opengroup.com/">.
|
|
|
|
<item>XFree86 can be found at
|
|
<url url="http://www.xfree86.org/">.
|
|
|
|
<item>The O'Reilly series on X Window! Visit <url
|
|
url="http://www.ora.com/">for the
|
|
definitive books on X.
|
|
|
|
<item>Much more information on using TrueType with X is at
|
|
<url url="http://www.freetype.org/">.
|
|
|
|
<item>The man pages for <bf>X</bf>, <bf>xterm</bf>, <bf>XFree86</bf>,
|
|
and
|
|
for any other clients you find yourself using often, are very useful
|
|
and
|
|
quite information-packed, and highly recommended. As the oft-repeated
|
|
saying goes, RTFM.
|
|
|
|
<item>There is a <bf>Remote X Apps</bf> MINI-HOWTO that is very helpful
|
|
in
|
|
figuring out how to run local and remote clients with X.
|
|
|
|
<item>Don't forget to visit <url url="http://www.gnome.org/"> and
|
|
<url url="http://www.kde.org/"> for the latest on unified desktop
|
|
environments in Linux, which are becoming more and more commonplace
|
|
all the time.
|
|
|
|
</itemize>
|
|
|
|
</article>
|