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.
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
.xinitrc
startup file such as xset dpms 2400 3600
4800
. The xset 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
dpmi
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 xlock preinstalled, or as an
option. This is a pretty basic and fairly nice screen saver. If you
run it with the -nolock
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 xdm, 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 xscreensaver 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 xset 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 xearth
or xdaliclock
, as
modules.
The latest version of xscreensaver can be found at
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
.Xdefaults
file:
!!! 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
If you are a fan of the text editor EMACS, 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
.emacs
file a shot, and read the info pages for more options.
Also look for an option to edit faces in the menus.
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
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.
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 Battery-Powered Mini-HOWTO contains instructions on patching this utility to show how much battery is left in your laptop, too.
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.
Displays CPU state (idle, nice, system, kernel) statistics, as well as Ethernet information.
Display the earth on your root window, many options for display available. Xscreensaver can use this as a screensaver module, for maximum fun.
A vector drawing program, particularly useful for charts and documentation. Quite useful but hard to get the hang of at first.
Font selection utility for X Window. Try the command
xterm -fn `xfontsel -print` &
to pick a font and then open
the
xterm window using that font.
Monitor your memory usage with a moving graph or the lights on your keyboard! If you use Window Maker, look for wmmon to do the same, but prettier.
A magnifying glass for X, with a couple other useful features.
Manual page browser for X. If the little box it starts with gets annoying, launch it with the -notopbox option.
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.
Basic bitmap painting program, for any real work you should grab GIMP.
User preference utility for X. You can change all sorts
of stuff with this. For instance, xset s 600
sets the screen
to blank after ten minutes.
Change the color of your desktop. If you have a
color
selector program like xcolorsel installed, try a command like
xsetroot -solid `xcolorsel`
to pick a color and set your
desktop
to that color.
You can run this program and click on any window for lots of useful information about it.
You can use the Intellimouse in X with a great many applications. There is an excellent resource page located at http://www.inria.fr/koala/colas/mouse-wheel-scroll/.
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 privelage, 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 configure. This assumes of course that
you've extracted the file and are in the directory. This program should
be run as ./configure
, and will automatically detect many
things
about your system. Afterwards, simply running make
and
perhaps
becoming root and running make install
will get the program up
on your system.
You may have to do a little more tinkering if you do not have a
configure script available. Many X programs require you to run
a
program to make the Makefile, called xmkmf
. If you
don't see a Makefile in your directory, this will sometimes
work, and will generate a suitable configuration for you, and you'll be
ready to make
from there.
Sometimes you will have run the configure 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 xscreensaver application, and found that it would support several 3D modes if the Mesa 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
config.cache
file, and run the configure 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).
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 ./configure && make
(or just
make
if there's no configure script), and then issue the
single command to install it as root by typing su -c "make
install"
, 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 do not 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 xterm or such application and
type in a command such as su -c "glint -display
:0.0"
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.