The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации | XWindow Frequently Asked Questions (FAQ) 2/7

useful information about the X Window System
Archive-name: x-faq/part2
Last-modified: 1996/09/26

Subject:  18)+ Can X11R6.1 be a freeware base? Will future X versions be free?

Here is the text of a letter from (Bob Scheifler) to
on 8 July 1996:

I suspect many of you have pretty much taken the X Consortium and the
software it produces for granted for the past few years.  Now that the X
Consortium will be going away, a few people have asked whether X will
continue to be available as free software in the future.

The X Consortium has never been a freeware organization.  We have long given
our software away, but that has been a means to an end, not an end unto
itself.  Making our software freely available helped promote the commercial
adoption of X by providing a level playing field, lowering the barrier to
entry into the market, and promoting homogeneity and interoperability.
Naturally, it also encouraged important R&D to take place within the academic
and freeware communities, which was another way of promoting commercial

What many of you probably don't know is that, had we not made the decision to
wind down the X Consortium, we had been planning to institute a new software
licensing plan starting with the upcoming Broadway release.  Although the
plan had been designed to have relatively little impact on non-commercial
users (and indeed relatively little impact on X Consortium members), X would
no longer have been free software in the usual sense of that term.

If the XFree86/Linux/GNU/university/etc. communities want to continue to
evolve X, then X11R6.1 is an excellent, and free, software base for you to
make use of.  Rights to that software can never be taken away from you.  The
Broadway release will, I hope, be an even better base, and one that will
still be free.  In a sense, once the X Consortium goes away, the freeware
community may be in a better position to choose their own path, independent
of what the UNIX platform vendors do.

I won't give you any promises about the licensing terms of future releases of
X from the Open Group.  It remains to be seen whether future releases will
add any substantial new technology, or just be maintenance releases.  While
the benefits of providing free software will not be ignored, the economics of
X and indeed of the whole UNIX desktop have changed, and the Open Group will
be working with the UNIX vendors and with us to formulate a business model
which makes sense in that context.  This will take some time, so don't expect
quick answers.

I'm sure some of you have questions about our ftp site, mailing lists, etc.
Those issues too will be dealt with during the remainder of this year.
Please be patient.

Subject:  20)  What are all these window managers? (Where can I get a "virtual" wm?)

The window manager in X is just another client -- it is not part of the X
window system, although it enjoys special privileges -- and so there is no
single window manager; instead, there are many, which support different ways
for the user to interact with windows and different styles of window layout,
decoration, and keyboard and colormap focus. In approximate chronological
order (generally, the more recent ones conformant more with the ICCCM and
are the only ones being maintained):

wm: this simple title-bar window manager was phased out in R2 or R3

uwm: the Universal Window Manager is still popular for its speed, although it
is very outdated. Moved to contrib/ on the R4 tape.

twm (old): Tom's Window Manager was among the first non-Consortium window
managers and offered the user a great deal of customization options in a
re-parenting window manager.

awm: the Ardent Window Manager was for a while a hotbed for hackers and
offered some features (dynamic menus) not found on more current window

rtl: Siemen's window manager tiles windows so that they don't overlap and
resizes the window with the focus to its preferred size.

dxwm: Digital's dxwm is part of the DECwindows offering

hpwm: HP's window manager offers a 3D look; it is a precursor of mwm

mwm: the Motif window manager is part of the OSF/Motif toolkit

tekwm: Tektronix's window manager offering

olwm (Sun): olwm implements the OPEN LOOK GUI and some of the Style Guide

olwm (AT&T): ditto

gwm: Bull's Generic Window Manager emulates others with a built-in Lisp
interpreter. Version 1.8 is in and on

m_swm: the Sigma window manager is on the R4 tape

pswm: Sun's PostScript-based pswm is part of the OpenWindows release

swm: Solbourne's swm is based on the OI toolkit and offers multiple GUI
support and also a panning virtual window; configuration information comes
from the resources file. Sources are on in R5contrib/swm.tar.Z; they
require OI binaries.

twm (new): the new Tab Window Manager from the R4 tape is a reworked twm and
is the basis for several derivatives, including the one on later X releases

vtwm: vtwm offers some of the virtual-desktop features of swm, with a
single-root window implementation.  A new version, vtwm-5.3, is based on the
R5 twm and is available from [1/94]

tvtwm: Tom's Virtual Tab Window Manager is also based on the Tab Window
Manager and provides a virtual desktop modeled on the virtual-root window of
swm. It is available on and mirroring archive servers. The current
[3/95] version is available at

olvwm: the vtwm-style virtual-desktop added to Sun's olwm. It is available on
archive servers; version 4.1 [2/94] is on

mvwm: the vtwm-style virtual-desktop added to OSF's mwm. A beta version is
floating around (most recently from but requires a
source license to OSF/Motif 1.1.3 [3/92].

NCDwm: the window manager local to NCD terminals offers an mwm look

XDSwm: the window manager local to Visual Technology's terminals is simple
but full-featured.

ctwm: Claude Lecommandeur's ( modification of the R5 twm
offers 32 virtual screens in the fashion of HP vuewm and also offers the
window overview used in vtwm and tvtwm. Version 3.3 [9/95] source is on and possibly also

vuewm: HP's MWM-based window manager offers configurable workspaces.  SAIC
offers a version of this VUE environment.

4Dwm: SGI's enhanced MWM

piewm: this version of tvtwm offers pie menus

pmwm: IXI's Panorama version of MWM offers olvwm-like features.  Info: +44
223 236 555, +1 408 427 7700; or or

fvwm: this virtual window manager has been rewritten from scratch and is very
light on system resources (between half and two-thirds the memory usage of
twm, on which it was based). fvwm offers most of the features others provide,
plus additional features. Source is available from in
/pub/Linux/X11/window-managers/; fvwm-1.24r-source.tar.z was current in 1/95;
2.1.0 is expected early 1996. Information: 
and .

mwm 2.0: the 2.0 version of mwm includes support for multiple workspaces.

9wm, by David Hogan (, is an X window manager which attempts
to emulate the Plan 9 window manager 8-1/2 as far as possible within the
constraints imposed by X.  The latest version of 9wm is held at .

mwfm: MWFM is a Microsoft-Windows-Program-Manager-style applications
manager.  It offers Unix users the ability to work in a MS-Windows-like
environment.  Sources are at

Also of possible use is vr, by Richard Mauri (, on and
(pub/comp/X11/contrib/clients/vr/vr-1.01.tar.Z); Vr is a workspace manager
intended to be window-manager-independent.

Subject:  21)  Why does my X session exit when I kill my window manager (sic)?

It needn't.  What is probably happening is that you are running your window
manager as the last job in your .xsession or .xinitrc file; your X session
runs only as long as the last job is running, and so killing your window
manager is equivalent to logging out. Instead, run the window manager in the
background, and as the last job instead invoke something safe like:

		exec xterm -name Login -rv -iconic

or any special client of your devising which exits on some user action.  Your
X session will continue until you explicitly logout of this window, whether
or not you kill or restart your window manager.

Alternatively, there is a chance that you are using OpenLook, which by
default kills all clients on logging out. Change your Exit menu choice from
EXIT to WMEXIT to correct this behavior.

Subject:  22)  Can I save the state of my X session, like toolplaces does?

Although no known window manager directly supports such a feature (olvwm and
swm may come close) -- which may be equivalent to writing out a
.xinitrc or .xsession file naming the geometry and WM_COMMAND of each
application  -- there is a contributed application which does much of what
you are looking for, although it is not as complete as the SunView program
toolplaces.  Look for the application "xplaces" on an archive-server near
you.  There are several versions of this program floating around; look for a
recent vintage.  [10/90]

Some new pseudo session-managers such as HP's vuewm provide for the saving of
sessions including information on the geometry of currently-running
applications and the resource database.  [Bjxrn Stabell
(; 3/93.]

In Release 6 a new session management protocol was defined, called XSMP (see
doc/specs/SM), for telling applications when to save their internal state and
for managing user dialog during the save.  R6 contains a very simple session
manager that exercises this protocol in the workInProgress directory; look
for xsm.  R6 also added a new shell widget class to Xt to make it easier to
write applications that react to messages from a session manager.  The window
managers still have to do the work to save the window positions. [Dave
Wiggins (; 5/94.]

Subject:  23)  How do I use another window manager with DEC's session manager?

DEC's session manager will start dxwm up by default. To override this, add to
your .Xdefaults file something like this line, naming the full pathname:

	sm.windowManagerName:   /wherever/usr/bin/X11/your_favorite_wm

Subject:  24)  How do I change the keyboard auto-repeat rate?

You can turn auto-repeat on or off by using "xset r on|off".

The base X11 protocol, doesn't provide for varying the auto-repeat rate,
which is a capability not supported by all systems.

Some pre-R6 servers may provide command-line flags to set the rate at
start-up time. If you have control over server start-up (see the man pages
for xinit and xdm), you can invoke the server with the chosen settings; for
example, you can start the R5 Xsun sample server with the options "-ar1 350
-ar2 30" to reduce the sensitivity of the keyboard.

The R6 X Keyboard Extension provides a vendor-independent way to control
repeat delay and rate.

Subject:  25)  How do I remap the keys on my keyboard to produce a string?

There is no method of arranging for a particular string to be produced when
you press a particular key. The xmodmap client, which is useful for moving
your CTRL and ESC keys to useful places, just rearranges keys and does not do
"macro expansion."

Some (few) clients, including xterm and several X-based editors, accept a
translation resource such as:

	xterm*VT100.Translations: #override \
		<Key>F1: string("setenv DISPLAY unix:0")

which permits the shorthand F1 to be pressed to reset the display locally
within an xterm; it takes effect for new xterm clients. To include control
characters in the string, use \nnn, where nnn is the octal encoding of the
control character you want to include.

Window managers, which could provide this facility, do not yet; nor has a
special "remapper" client been made available.

Subject:  26)  How do I make a screendump or print my application (including menus)?

The xwd client in the X11 distributions can be used to select a window or the
background. It produces an XWD-format file of the image of that window.  The
file can be post-processed into something useful or printed with the xpr
client and your local printing mechanism. To print a screendump including a
menu or other object which has grabbed the pointer, you can use this

		csh% sleep 10; xwd -root > output.xwd &

and then spend 10 seconds or so setting up your screen; the entire current
display will be saved into the file output.xwd. Note that xwd also has an
undocumented (before R5) -id flag for specifying the window id on the
command-line. [There are also unofficial patches on to xwd for
specifying the delay and the portion of the screen to capture.]

Note that xwd makes the assumption that it can make a single XGetImage call
and then decode the returned pixels via the associated colormap; the pixels
returned are undefined if the area you've selected includes multiple windows
with varying visuals, colormaps, or double-buffer states.

Two publicly-available programs which allow interactive definition of
arbitrary portions of the display and built-in delays are xsnap and xgrabsc.

xgrabsc is a free screendump program that provides multiple selection styles
and several output formats.  Selection styles include xwd-style point and
click, dragging a rectangle over an arbitrary portion of the screen, timed
snapshots for menu capturing, and keyboard-based selection.  Output formats
are xwd, XPM (v1 and 2), bitmap, puzzle, and monochrome, greyscale, and color
PostScript.  PostScript output can be in ready-to-print true-scale form or
encapsulated for inclusion in Frame, xfig, and other programs that accept EPS
graphics.  There are several versions of xgrabsc; version 2.3, available on [9/93] is the most recent.  xgrab, part of the package, is an
interactive front-end to xgrabsc.

xwpick (formerly xpick) (by Evgeni Chernyaev ( is
available on as xwpick-2.20.tar.Z; it creates Level 2 color
PostScript dumps of X screens and can generate GIF, PICT, and other formats.
PostScript output is very small. xwpick runs under VMS and Unix systems.

xsnap includes some asnap features and supersedes it; it also renders XPM
output [version unknown]. It is available on or; see

A screen-dump and merge/edit program combining features of xwd and xpr is
available from as xdump1.0.tar.Z.  Information:

xprint, by Alberto Accomazzi ( is available from ( as /pub/wipl/xprint.export-2.1.tar.Z.  The
package allows users to create encapsulated color PostScript files which will
print on any PostScript Level-1 compliant printer (black and white or

To post-process the xwd output of some of these tools, you can use xpr, which
is part of the X11 distribution (moved to contrib in R6). Also on several
archives are xwd2ps and "import" (formerly XtoPS), which produce Encapsulated
PostScript with trimmings suitable for use in presentations (see and
contrib/applications/ImageMagick/ImageMagick3.7.tar.Z). Also useful is the
PBMPLUS/Netpbm package on many archive servers; and the Xim package contains
Level 2 color PostScript output.

The xv program can grab a portion of the X display, manipulate it, and save
it in one of the available formats. ImageMagick has similar capabilities.


HP's capture tool (provided with MPower and SharedPrint) corrects some of
the problems xwd has with XGetImage.

Bristol Technology (, 203-438-6969) offers Xprinter, an Xlib
API for PostScript and PCL printers; a demo is in

ColorSoft 9619-459-8500) offers OPENprint; the package includes a
screen-capture facility, image-processing, and support for PostScript and
non-PostScript printers.

Some vendors' implementations of X (e.g. DECWindows and OpenWindows) include
session managers or other desktop programs which include "print portion of
screen" or "take a snapshot" options. Some platforms also have tools which
can be used to grab the frame-buffer directly; the Sun systems, for example,
have a 'screendump' program which produces a Sun raster file.  Some X
terminals have local screen-dump utilities to write PostScript to a local
serial printer.

Some vendors' implementations of lpr (e.g. Sony) include direct support for
printing xwd files, but you'll typically need some other package to massage
the output into a useful format which you can get to the printer.

Subject:  27)  How do I make a color PostScript screendump of the X display?

If you need color PostScript in particular, you can 

	- grab the screen-image using a program which can produce color 
PostScript, such as xgrabsc, xprint, xwpick, and xv

	- grab the screen-image using xwd and post-process xwd into color PS.

You can do this using xwd2ps or the "import" (formerly XtoPS) program from
the ImageMagick distribution. The PBMPLUS/Netpbm package is also good for
this, as is the Xim package.


Another alternative is to use the Xprinter product from Bristol Technology,
Inc. which provides PostScript output using the Xlib API.  Send email to for details.

Subject:  28)  How do I make a screendump without having an X display?

Some applications need to be able to make a screendump at a point at which
they don't have access to an X display or can't rely on one or can't rely on
an unsupervised screendump operating correctly. An option for all these cases
is to use the xvfb X Virtual Frame Buffer in X11R6.  The X Virtual Frame
Buffer Server uses memory allocated in the process heap or even mmapped to a
file as its frame buffer.

Subject:  29)  How do I make a screendump including the X cursor?

This can't be done unless the X server has been extended. Consider instead a
system-dependent mechanism for, e.g.,  capturing the frame-buffer.

Subject:  30)! How do I convert or view Mac/TIFF/GIF/Sun/PICT/img/FAX images in X?

The likeliest program is an incarnation of Jef Poskanzer's useful++ Portable
Bitmap Toolkit, which includes a number of programs for converting among
various image formats. It includes support for many types of bitmaps,
gray-scale images, and full-color images. PBMPLUS has been updated recently;
the most recent version [12/91] is on in

Netpbm is based on the PBMPLUS 10dec91 release, with many additions and
improvements. It is intended to be portable to many platforms while allowing
for conversion of images between a variety of formats. The latest sources are
on several sites, including,
( and ( Contact to be added to the netpbm mailing list.

xpdf, a Portable Document Format (PDF) viewer for X, is at (source and
binaries, especially Linux binaries): . Version 0.4
became available 4/96.

Certain pixmap editors (e.g. xpaint) can read in a variety of formats and
write out in different formats.

Another tool is San Diego Supercomputing Center's IMtools ('imconv' in
particular), which packages the functionality of PBM into a single binary.
It's available anonymous ftp from (

Useful for viewing and converting some image-formats is Jim Frost's
xloadimage; the most recent [11/93] is on in
R5contrib/xloadimage.4.1.tar.Z.  Graeme Gill's updates to an earlier version of
xloadimage are also on; see xli.README and xli.tar.Z.uu; version
1.15 was released 7/93.

xv (X Image Viewer), written by John Bradley ( for XV
questions), can read and display pictures in Sun Raster, PGM, PBM, PPM, X11
bitmap, TIFF, GIF and JPEG. It can manipulate on the images: adjust, color,
intensity, contrast, aspect ratio, crop). It can save images in all of the
aforementioned formats plus PostScript. It can grab a portion of the X
display, manipulate on it, and save it in one of the available formats. The
program was updated 5/92; see the file R5contrib/xv-2.21.tar.Z on
Version 3.10a [3/95] is distributed as shareware. New versions are on in pub/xv.

The latest revision of XAnim is 2.70.3 and can handle a wide range of audio
and video formats, including Quicktime, AVI, FLI, IFF, GIF, MJPG.  XAnim's
available from the XAnim Home Page at or via [3/96].

xa, an xview-based X11 animation tool by Derek Richardson
(, is available at [5/96].

The Fuzzy Pixmap Manipulation, by Michael Mauldin (
Conversion and manipulation package, similar to PBMPLUS.  Version 1.0
available via FTP as,, and

The Img Software Set, by Paul Raveling <>, reads and
writes its own image format, displays on an X11 screen, and does some image
manipulations.  Version 1.3 is available via FTP on as
R5contrib/img_1.3.tar.Z, along with large collection of color images.

The Utah RLE Toolkit is a conversion and manipulation package similar to
PBMPLUS.  Available via FTP as*,*, and*.

Xim, The X Image Manipulator, by Philip Thompson, does essential interactive
displaying, editing, filtering, and converting of images. There is a version
in the X11R4 contrib area; but a more recent version (using R4 and Motif 1.1)
is available from ( Xim reads/writes gif, xwd, xbm,
tiff, rle, xim, (writes level 2 eps) and other formats and also has a library
and command-line utilities for building your own applications.

ImageMagick by is an X11 package for display and
interactive manipulation of images.  Includes tools for image conversion,
annotation, compositing, animation, and creating montages.  ImageMagick can
read and write many of the more popular image formats (JPEG, TIFF, PNM,
PostScript, ...).  Available via FTP from as
contrib/applications/ImageMagick/ImageMagick3.7.tar.Z. [12/95] See also .

GIMP is a General Image Manipulation Program. It is available at or via email to It is currently [12/95] in beta.

xtiff is a tool for viewing a TIFF file in an X window.  It was written to
handle as many different kinds of TIFF files as possible while remaining
simple, portable and efficient.  xtiff illustrates some common problems with
building pixmaps and using different visual classes.  It is distributed as
part of Sam Leffler's libtiff package and it is also available on
and comp.sources.x.  [,10/90] xtiff 2.0 was announced in
4/91; it includes Xlib and Xt versions.

gpv is an image viewer with processing capabilities.  It uses Pacco to get
all the image processing support and it is coded entirely in TCL.  Gpv can be
fetched at . The latest
release of Pacco is at .

A version of Lee Iverson's (leei@McRCIM.McGill.EDU) image-viewing tool is
available as R5contrib/vimage-0.9.3.tar.Z on The package also
includes an ImageViewPort widget and a FileDialog widget.  [12/91;5/92]

The Andrew User Interface System (version 5.2 and later) provides an image
inset which can view many image formats.  Like all Andrew insets, an image
can be incorporated in a a document or sent in email via the MIME standard.
The following formats can be read:  Sunraster, GIF, Xbitmap,  TIFF, Xpixmap,

The LUG (Libreria de Utilidades Graficas) is a library of subroutines
offering several routines for the manipulation of images in several different
formats. The distribution includes viewers for several different platforms.
The distribution is on (

The X Image Extension (XIE), an X Consortium standard in R6, provides
facilities for transmitting displaying fax (G3, G4), TIFF, and JPEG images.

[some material from Larry Carroll (, 5/91]

A distributed real-time MPEG video and audio player is available from ( in /pub/dsrg/Player/
( ) [5/95].

Subject:  31)  Where can I get an X-based 3-D object viewer?

xmgf by Paul Hoad ( is an interactive tool for viewing
2D and 3D objects typically in gf/OFF/NFF/IGRIP/MINICAD/SLA/DXF format
Sources are on  Version 1.9.1 became available 12/93.

x3d is a V.Fast 3D Object viewer for X it needs no special hardware or or
widget libraries other that X and is optimized for speed.

XGobi can be used to to view such data.
VOGLE can be used to to view such data.

An interactive 3D viewer based on the X Window System is "Geomview";
information is available at .

xdim 2.6 is available [1/96] from .  XDim
combines features from data processing (p.ex. import from table calc.
programs) and image processing (p.ex. import GIF's and JPEG's) with an
interactive 3D Viewer and Motif user interface.

Grapher-3D generates surfaces of two variable functions allowing users to
view these surfaces from any three dimensional position.  Dynamic axis
rotation and domain shifting help better illustrate the nature of a
function.  Sources are on in contrib/graphics/Grapher-3D/,
including source grapher-3d-1.2.tar.gz and some binary sets. [3/96]

Also of use:

Hv (for Hot Views)  is a library that greatly simplifies the development of
applications with a sophisticated graphical user interface. It is layered on
top of X, Xt (R4 or later), and OSF Motif (version 1.1 or later); however,
the developer is completely insulated from those libraries. Information: Sources are on .
Subject:  32)  How can I change the titlebar of my terminal window?

The solution involves sending an escape sequence to xterm which will cause it
to update the property which the window manager relies upon for the string
which appears in the window titlebar.

A solution is as easy as typing this in an xterm running a shell:

		echo "ESC]2;TEXT^G"

where ESC is the escape key, TEXT is the string you wish to have displayed,
and ^G is a Control-G (the BEL character). Note that the semi-colon is
demanded by more recent versions of xterm. (Some shells and editors need an
escape character, typically ^V, before accepting control characters

Here is a more complicated csh alias which changes the titlebar to the
current working directory when you change directories:

		alias newcd 'cd \!*; echo -n ESC]2\;$cwd^G'

(for other shells e.g. ksh you will need to write a function for cd to print
this value).

The digit '2' in these strings indicates to xterm that it should change only
the title of the window; to change both the title and the name used in the
icon, use the digit '0' instead, and use '1' to change only the icon name.

Note: another way to do this, which prevents an incorrect display of the
local directory if a modified `cd` is used in a subshell, is to wrap the
escape sequences into the PS1 prompt itself.

If you are using DECterm, the sequence for window titles is
"ESC]21;TEXTESC\"; for icons, the sequence is "ESC]2L;TEXTESC\".  For an
HPterm, you need "ESC&f0k<length>DTEXT". Here <length> is the number of
characters in TEXT, as a decimal number in ASCII. To change the icon name,
use "ESC&f-1k<length>DTEXT".  [thanks to Karsten Spang (;

Subject:  33)  Where can I find the xterm control sequences?

The best source of such information is in your R5/R6 sources in the file (R6: xc/doc/specs/xterm/; a PostScript version is in
your R5 sources in mit/hardcopy/clients/ctlseqs.PS.Z and your R6 sources in

Both editions of O'Reilly's Volume 3, the X User's Guide, include an R5
version of the control sequences.

Other good sources of information include the R4 version of that document and
also the file in the R4 sources called mit/clients/xterm/ctlseq2.txt, a
compilation put together by Skip Montanaro (GE CR&D) listing the VT100
sequences. It dates from R3 but is fairly accurate.  A hardcopy version was
published in the December 1989 XNextEvent (the XUG newsletter).

In a pinch, a VT100 manual will do.

[last updated 10/91]

Subject:  34)  How can I use characters above ASCII 127 in xterm ?

	In order to use special characters such as the o-umlaut, you need to
"stty pass8" (you may need "stty -parenb -istrip cs8" on strictly-POSIX
systems) but also to use a charcell ISO8859 font, such as
	XTerm*font:     -*-*-medium-r-normal-*-*-130-*-*-c-*-iso8859-1
	XTerm*boldfont: -*-*-bold-r-normal-*-*-130-*-*-c-*-iso8859-1 
[The family is intentionally unspecified in this example.]

In addition, you may want to set this in your shell:
	setenv LC_CTYPE iso_8859_1

	For a given character above 127, you can determine the key to use with
the Alt modifier by finding the equivalent character below 127 (try using `man
ascii`). For example, o-umlaut (v) is Alt-v and the section character (') is

[thanks to Greg Holmberg ( and Stephen Gildea
(; 6/92]

Subject:  35)  Why are my xterm menus so small (sic) ?

You are probably setting the geometry small accidentally. If you give a
resource specification like this:

		xterm*geometry: 80x24

then you are asking for all widgets under xterm to have their geometry set to
80x24. For the main window, this is OK, as it uses characters for its size.
But its popup menus don't; they are in pixels and show up small. To set only
the terminal widget to have the specified geometry, name it explicitly:

		xterm*VT100.geometry: 80x24

Subject:  36)! How can I control the mouse with the keyboard?

If you have the X Keyboard (XKB) Extension, you can enable mouse keys, which
makes it possible to generate mouse motion and button events using the
keyboard.   Events generated by MouseKeys are completely transparent -- they
will work with any application that connects to a server that has the X
Keyboard Extension, regardless of whether the application itself uses XKB.

XKB is enabled by default in X11R6.1.  

First, set up the Num Lock key so that Shift+Num_Lock toggles mouse keys:

 xmodmap -e "keysym Num_lock = Num_Lock Pointer_EnableKeys"

(XFree86 3.1.2E is based on R6.1 and has the X Keyboard Extension; it also
has a binding to Pointer_EnableKeys in its default keymap.  You use
Alt+Shift+Num_Lock to toggle MouseKeys on and off.  If you are using an
earlier release of X or XFree86, you won't have XKB and the instructions will
not work. See for more information.)

You might also have to turn off server num lock for this to work.  
Now press "Shift+Num_Lock" to enable MouseKeys.  When MouseKeys are on:

o)   The keypad arrow keys move the pointer
o)   The keypad '5' key behaves like the 'default' pointer button
o)   The keypad '0' key locks the default pointer button (for easy dragging)
o)   The keypad '.' key unlock the default pointer button (to release a drag)
o)   The keypad '+' key double-clicks the default pointer button.
o)   The keypad '/' key sets the 'default' button to Button1
o)   The keypad '*' key sets the default button to Button2
o)   The keypad '-' key sets the default button to Button3

This is the default configuration, but the mechanism allows for nearly
infinite configurability.

[thanks to Erik Fortune (, 6/96]

Subject:  37)  How can I print the current X selection?

You could paste it into an xterm after executing the lpr command.  However, a
program by Richard Hesketh ( specifically for manipulating the
selection will help; e.g.

	% xselection PRIMARY | lpr 

finds the primary selection and prints it.

This command can be placed in a window-manager menu or in shell-scripts.
xselection also permits the setting of the selection and other properties. A
version is on

Also available is, which can be
adapted to do this.

Subject:  38)  Where are the resources loaded from?

The resources of a widget are filled in from the following places (from
highest priority to lowest priority):

	1. Args passed at creation time.
	2. Command line arguments.
	3. User's per host defaults file
	4. User's defaults file.
	5. User's per application default file.
	6. System wide per application default file.

Note that 2-6 are read only once on application startup.  The result of steps
3-6 is a single resource database used for further queries.

Please see the FAQ, from which this information is
abstracted, for a full explanation of how to specify the location of files;
see also a good book on Xt, such as ORA's Volume 4, the Asente/Swick book, or
the Xt documentation, for more information.

Subject:  39)  How does Xt use environment variables in loading resources?

	You can use several environment variables to control how resources are
loaded for your Xt-based programs -- XFILESEARCHPATH, XUSERFILESEARCHPATH, and
XAPPLRESDIR.  These environment variables control where Xt looks for
application-defaults files as an application is initializing.  Xt loads at
most one app-defaults file from the path defined in XFILESEARCHPATH and
another from the path defined in XUSERFILESEARCHPATH.

	XAPPLRESDIR existed in R3 and before.  As of R4, the Xt developers
added the more sophisticated *SEARCHPATH mechanism, but left XAPPLRESDIR in
place to avoid breaking existing software.

	Set XFILESEARCHPATH if software is installed on your system in such a
way that app-defaults files appear in several different directory
hierarchies.  Suppose, for example, that you are running Sun's Open Windows,
and you also have some R4 X applications installed in
/usr/lib/X11/app-defaults. You could set a value like this for
XFILESEARCHPATH, and it would cause Xt to look up app-defaults files in both
/usr/lib/X11 and /usr/openwin/lib (or wherever your OPENWINHOME is located):
	setenv XFILESEARCHPATH /usr/lib/X11/%T/%N:$OPENWINHOME/lib/%T/%N

The value of this environment variable is a colon-separated list of
pathnames.  The pathnames contain replacement characters as follows (see

	%N      The value of the filename parameter, or the
		application's class name.  
	%T      The value of the file "type".  In this case, the
		literal string "app-defaults" 
	%C      customization resource (R5/R6 only) 
	%D	site default value for XFILESEARCHPATH (R6 only)
	%S      Suffix.  None for app-defaults.  
	%L      Language, locale, and codeset (e.g. "ja_JP.EUC") 
	%l      Language part of %L (e.g. "ja") 
	%t      The territory part of the display's language string 
	%c      The codeset part of the display's language string

	Let's take apart the example.  Suppose the application's class name is
"Myterm". Also, suppose Open Windows is installed in /usr/openwin.
(Notice the example omits locale-specific lookup.)
	/usr/lib/X11/%T/%N        means /usr/lib/X11/app-defaults/Myterm
	$OPENWINHOME/lib/%T/%N    means /usr/openwin/lib/app-defaults/Myterm

	As the application initializes, Xt tries to open both of the above
app-defaults files, in the order shown.  As soon as it finds one, it reads it
and uses it, and stops looking for others.  The effect of this path is to
search first in /usr/lib/X11, then in /usr/openwin.

	Let's consider another example. This time, let's set
XUSERFILESEARCHPATH so it looks for the file in the current working
directory, then for Myterm in the directory ~/app-defaults.
	setenv XUSERFILESEARCHPATH ./$HOME/app-defaults/%N

	The first path in the list expands to ./  The second expands
to $HOME/app-defaults/Myterm.  This is a convenient setting for debugging
because it follows the Imake convention of naming the app-defaults file in the application's source directory, so you can run the
application from the directory in which you are working and still have the
resources loaded properly.  NOTE: when looking for app-default files with
XUSERFILESEARCHPATH, for some bizarre reason, neither the type nor file suffix
is defined so %T and %S are useless.

	With R5 and R6, there's another twist.  You may specify a customization
resource value.  For example, you might run the "myterm" application like
	myterm -xrm "*customization: -color"

	If one of your pathname specifications had the value
"/usr/lib/X11/%T/%N%C" then the expanded pathname would be
"/usr/lib/X11/app-defaults/Myterm-color" because the %C substitution character
takes on the value of the customization resource.

	The default XFILESEARCHPATH, compiled into Xt, is:
		/usr/lib/X11/%L/%T/%N%C:\  (R5) 
		/usr/lib/X11/%l/%T/%N%C:\  (R5)
		/usr/lib/X11/%T/%N%C:\     (R5) 
		/usr/lib/X11/%l/%T/%N:\ /usr/lib/X11/%T/%N

	(Note: some sites replace /usr/lib/X11 with a ProjectRoot in this
batch of default settings.)

	The default XUSERFILESEARCHPATH, also compiled into Xt, is
		<root>/%L/%N%C:\  (R5) 
		<root>/%l/%N%C:\  (R5)
		<root>/%N%C:\     (R5) 

	<root> is either the value of XAPPLRESDIR or the user's home directory
if XAPPLRESDIR is not set.  If you set XUSERFILESEARCHPATH to some value other 
than the default, Xt ignores XAPPLRESDIR altogether.

	Notice that the quick and dirty way of making your application find
your app-defaults file in your current working directory is to set XAPPLRESDIR
to ".", a single dot.  In R3, all this machinery worked differently; for R3
compatibilty, many people set their XAPPLRESDIR value to "./", a dot followed
by a slash.

[Thanks to Oliver Jones (; 2/93.]

Subject:  40)  How to I have xdm put a picture behind the log-in window?

R5/R6 users can specify the "setup" script that xdm runs by changing the
entry in the xdm-config file (usually in /usr/lib/X11/xdm) to name a
different script; the sample script distributed with the X distribution
simply runs xconsole.  See the SETUP PROGRAM section of the xdm man page in
R6 for precise details.

Pre-R5 versions of the xdm client could be spoofed by in changing xdm's xrdb
resource in the xdm-config file to run a program to change the background
before loading the resources; for example, your /usr/lib/X11/xdm/xdm-config
file may add the line
	DisplayManager.0.authorize: false 
to permit unrestricted access to the display before log-in (beware!) and also
	DisplayManager*xrdb:    /usr/lib/X11/xdm/new.xrdb 
where that file does something (for all connections) along the lines of:
	#comes in with arguments: -display :0 -load /usr/lib/X11/xdm/Xresources
	/usr/bin/X11/xsetroot -display $2 -bitmap /usr/lib/X11/xdm/new.bitmap 
	/usr/bin/X11/xrdb $* 
Substitute xloadimage or xv for xsetroot, to taste.  Note that this is a
general hack that can be used to invoke a console window or any other client.

[Thanks to Jay Bourland (, 9/91]

Subject:  41)  Why isn't my PATH set when xdm runs my .xsession file?

	When xdm runs your .xsession it doesn't source your .cshrc or .login
files. You can set the path explicitly as you normally could for any SH
script; or you can place all environment-setting statements in a separate file
and source it from both the .xsession file and your shell configuration file;
or, if you set your PATH in your .cshrc file, the normal place, you can make
your .xsession have PATH set simply by making it a csh script, i.e. by starting
your .xsession file off with "#!/bin/csh".
	If this doesn't work, also try starting off with:
	#!/bin/sh # Reset path:  PATH=`csh -c 'echo $PATH'` ; export PATH

Subject:  42)  How do I keep my $DISPLAY when I rlogin to another machine?

There are several ways to avoid having to do a "setenv DISPLAY ..." whenever
you log in to another networked UNIX machine running X.

A trivial solution, if your account is cross-mounted on both machines, is to
have your .xsession write your DISPLAY variable to a file, and then in your
login dot-files to check for the existence of that that file and use its
contents as your DISPLAY. [Thanks to]

One solution is to use the clients/xrsh on the R5 and R6 contrib tapes.  It
includes xrsh, a script to start an X application on remote machine, and
xrlogin, a script to start a local xterm running rlogin to a remote machine.
A more recent version is on export in contrib/utilities/xrsh-5.8.shar.gz

One solution is to use the xrlogin program from der Mouse
( You can ftp caveat-emptor versions from ( in pub/people/mouse/X/xrlogin/.  The program
packages up $TERM and $DISPLAY into a single string, which is stuffed into
$TERM.  rlogin then propagates $TERM normally; your .cshrc on the remote
machine should contain

		eval `xrlogind`

where xrlogind is a program that checks $TERM and if it is of the special
format it recognizes, unpacks it and spits out setenv and unsetenv commands
to recreate the environment variables. [11/90]

In addition, if all you need to do is start a remote X process on another
host, and you find

		rsh <HOST> -n /usr/bin/X11/xterm -display $DISPLAY 

too simple (DISPLAY must have your real hostname), then this version of xrsh 
can be used to start up remote X processes. The equivalent usage would be 

		xrsh <HOST> xterm

  #! /bin/sh
  # start an X11 process on another host
  # Date: 8 Dec 88 06:29:34 GMT
  # From: Chris Torek <>
  # rsh $host -n "setenv DISPLAY $DISPLAY; exec $@ </dev/null >&/dev/null"
  # An improved version:
  # rXcmd (suggested by John Robinson,
  #       (generalized for sh,ksh by Keith Boyer,
  # but they put the rcmd in ()'s which left zombies again.  This
  # script combines the best of both.
  case $# in
  [01])  echo "Usage: $0 host x-cmd [args...]";;
  	case $SHELL in
  	*csh*)  host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"setenv TERM xterm; setenv DISPLAY `hostname`:0; \
  			exec $* </dev/null >& /dev/null" &
  		host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"TERM=xterm export TERM; \
  			DISPLAY=`hostname`:0 export DISPLAY; \
  			LD_LIBRARY_PATH=/usr/X11/lib export LD_LIBRARY_PATH; \
  			PATH=\$PATH:/usr/X11/bin:/usr/bin/X11:/usr/local/bin; \
			export PATH; \
  			exec $* < /dev/null > /dev/null 2>&1" &

You may also want to look at programs/rstart in the R6 distribution; this
remote execution protocol is intended to work in concert with session

Subject:  43)  How can I design my own font?

One way is to use the "bitmap" client or some other bitmap-editor (e.g.
Sun's icon-editor tool, post-processed with pbmplus) to design the individual
characters and then to do some large amount of post-processing to concatenate
them into the BDF format. See Ollie Jones's article in the November 91 X
Journal for more information.

The R3 contrib/ area (in fonts/utils/ and in clients/xtroff) contained a
number of useful utilities, including some to convert between BDF font format
and a simple character format which can be edited with any text editor.

An easier way is to use the "xfed" client to modify an existing font; a
version is on the R4 or R5 X11R5 contrib tape in contrib/clients/xfed. Xfed
was last seen on ftp.Informatik.Uni-Dortmund.DE [], possibly as
file /pub/windows/X/Diverse-X11-Sourcen/xfed.tar.Z. It can produce BDF-format
fonts which can be compiled for a variety of X servers.

IBM machines appear to have a utility "fontutil".

The xfedor client from Group Bull permits creation of bitmaps, cursors, XPM1
pixmaps, and fonts. Binaries for common machines are on in
/pub; in addition, the sources (an old Xlib implementation) have been placed
[5/91] in

If you are a MetaFont user you can use "mftobdf" from the SeeTeX distribution
to convert PK, GF, and PXL fonts to BDF format; the distribution is on and on

The GNU package fontutils-0.4.tar.Z on includes xbfe, a font
editor, and a number of utilities for massaging font formats.

The O'Reilly X Resource issue #2 contains an article on using these tools to
modify a font.

Fonts can be resized with Hiroto Kagotani's bdfresize; a new version is in  bdffont in the Andrew User Interface
System (versions 5.2.2 and higher) lets you create a font or edit an existing

Subject:  44)  Why does adding a font to the server not work (sic)?

	After you have built the font using your system's font-compiler,
installed it in some directory, and run `mkfontdir` or your system's
equivalent (e.g. bldfamily for OpenWindows) in that directory, be sure to use
`xset +fp $dir` to add that full path-name to the server's font-path, *or* if
the directory is already in the path, use `xset fp rehash` so that the new
fonts in that directory are actually found; it is this last step that you're
probably leaving out. (You can also use `xset q` to make sure that that
directory is in the path.)
	Sometimes your "xset +fp $dir" command fails with a BadValue error:
		X Error of failed request:BadValue
			(integer parameter out of range for operation) 
		Major opcode of failed request:  51 (X_SetFontPath)

	This means the X server cannot find or read your font directory, or
that your directory does not look like a font directory to the server.  (The
mention of an "integer parameter" in the message is spurious.)

-- Is the font directory you're specifying readable from the SERVER's file
   system?  Remember, it's the server, not the client, which interprets your
   font directory.  Trouble in this area is especially likely when you issue
   an xset command with shell metacharacters in it (e.g. "xset +fp ~/myfonts")
   and the server is an X terminal or managed by xdm.

-- Is the directory really a font directory?  If you're running the sample X
   server (or most varieties of vendor servers) look in the directory for the
   file "fonts.dir".  If you can't find that file, run mkfontdir(1). (If you're
   running OpenWindows, look for the file "Families.list".  If you can't find
   it, run bldfamily(1).)

-- If you're in a site where some people run X11Rn servers and others run a
   proprietary server with nonstandard font formats (OpenWindows, for
   example), make sure the font directory is right for the server you're
   using.  Hint: if the directory contains .pcf and/or .snf files, it won't
   work for Open Windows.  If the directory contains .ff and/or .fb files, it
   won't work for X11Rn.

[thanks to der Mouse ( and to Oliver Jones
(; 7/92 ]

Note: some systems (e.g. X11R4 on AIX) need a trailing '/' in the directory

Subject:  45)  How do I convert a ".snf" font back to ".bdf" font?

A tool called "snftobdf 1.6" can do this; it is available as:

Subject:  46)  What is a general method of getting a font in usable format?

der Mouse's getbdf is one solution; it connects to a server and produces a
BDF file for any font the server is willing to let it.  It can be used as an
anything-to-BDF converter, but requires access to a server that can
understand the font file, thus is both more and less powerful than other
tools such as snftobdf. getbdf is on in X/getbdf.c or available
via mail from mouse@larry.McRCIM.McGill.EDU. [5/91]

In addition, the R5/R6 program "fstobdf" can produce bdf for any font that
the R5 server has access to.

Subject:  47)  How do I use DECwindows fonts on my non-DECwindows server?

The DECwindows fonts typically don't exist on a non-DEC installation,
but rewrite rules can be used to alias fonts used by DECwindows applications
to standard X fonts of similar characteristics and size. Pick up the file
R5contrib/DECwindows_on_X11R4_font.aliases from; this file is for a
sample R4 server.  It can also serve as a starting point for creating a
similar aliases file for the Open Windows server or other servers which do not
use the X Consortium's font scheme.


David B. Lewis

		"Just the FAQs, ma'am." -- Joe Friday 

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2022 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру