home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Unix Power ToolsUnix Power ToolsSearch this book

6.9. Listing the Current Resources for a Client: appres

The appres (application resource) program lists the resources that currently might apply to a client. These resources may be derived from several sources, including the user's .Xresources file and a system-wide application defaults file. The directory /usr/lib/X11/app-defaults contains application-default files for several clients. (Note that it may be in a different place depending on how your X11 is installed; on Mac OS X, which does not come with X by default, you might find it in /usr/X11R6/etc/app-defaults in one popular install or /usr/local/lib/X11/app-defaults in another.) The function of these files is discussed in the next section. For now, be aware that all of the resources contained in these files begin with the class name of the application.

Also be aware that appres has one serious limitation: it cannot distinguish between valid and invalid resource specifications. It lists all resources that might apply to a client, regardless of whether the resources are correctly specified.

appres lists the resources that apply to a client having the class_name and/or instance_name you specify. Typically, you would use appres before running a client program to find out what resources the client program will access.

For example, say you want to run xterm, but you can't remember the latest resources you've specified for it, whether you've loaded them, what some of the application defaults are, etc. You can use the appres client to check the current xterm resources. If you specify only a class name, as in this command line:[32]

[32]The class name of xterm starts with two uppercase letters; this is contrary to the naming scheme followed by most other application classes.

% appres XTerm

appres lists the resources that any xterm would load. In the case of xterm, this is an extensive list, encompassing all of the system-wide application defaults, as well as any other defaults you have specified in a resource file.

You can also specify an instance name to list the resources that applies to a particular instance of the client, as in:

% appres XTerm bigxterm

If you omit the class name, xappres assumes the class -NoSuchClass-, which has no defaults, and returns only the resources that would be loaded by the particular instance of the client.

Note that the instance can simply be the client name, e.g., xterm. In that case none of the system-wide application defaults would be listed, since all begin with the class name XTerm. For example, the command:

% appres xterm

might return resources settings similar to these:

xterm.vt100.scrollBar:  True
xterm*PhonyResource:    youbet
xterm*pointerShape:     gumby
xterm*iconGeometry:     +50+50
*VT100.Translations:    #override\
    Button1 <Btn3Down>:   select-end(CLIPBOARD)\n\
    ~Ctrl ~Meta <Btn2Up>: insert-selection(primary,CLIPBOARD)

Most of these resources set obvious features of xterm. The translation table sets up xterm to use the xclipboard. Notice also that appres has returned an invalid resource called PhonyResource that we created for demonstration purposes. You can't rely on appres to tell you what resources a client will actually load because the appres program cannot distinguish a valid resource specification from an invalid one. Still, it can be fairly useful to jog your memory as to the defaults you've specified in your .Xresources file, as well as the system-wide application defaults.

--VQ and SJC

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.