Next Previous Contents

9. Clients and Application Tips

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.

9.1 Screen Savers for X

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 0. 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 and the second option is how many seconds before the power saving feature starts. The third option configures something else.

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
 

9.2 Emacs and XEmacs

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)
 

9.3 Some Useful Programs and Tricks

appres

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.

rclock

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.

rxvt

A nice replacement for xterm - uses less memory, works faster, and lets you put in a background pixmap, but it lacks a few of xterm's features, like switching fonts on the fly.

xcpustate

Displays CPU state (idle, nice, system, kernel) statistics, as well as Ethernet information.

xearth

Display the earth on your root window, many options for display available.

xfig

A vector drawing program, particularly useful for charts and documentation. Quite useful but hard to get the hang of at first.

xfontsel

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.

xload

Monitor your memory usage with a moving graph or the lights on your keyboard!

xmag

A magnifying glass for X, with a couple other useful features.

xman

Manual page browser for X. If the little box it starts with gets annoying, launch it with the -notopbox option.

xmodmap

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.

xpaint

Basic bitmap painting program, for any real work you should grab GIMP.

xset

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.

xsetroot

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.

xwininfo

You can run this program and click on any window for lots of useful information about it.

9.4 Libraries and Compiling X Applications

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).


Next Previous Contents