Appendix C

Customising the X Resources Files


C.1

Introduction

The XResources (X defaults) are a list of properties which affect the appearance of your X-windows applications. The appeareance of these can be changed by editing the XResources file. For example, font, background colour, foreground colour, position and size (geometry), and text can be changed.

Programs which use XResources files in Topog are

The default resources for Topog are kept in the directory called /usr/lib/X11/app-defaults, in files:

Display
Profile
Topog
Histog
Demgen
for
for
for
for
for
Topog_Display
Topog_Profile
Topog_Chart
Topog_Xhistog
Topog_Demgen

C.2

Examples

C.2.1

An example of the contents of a XResources file is:

XClock.*background: blue
XTerm.*font: rom14
XTerm.*scrollbar: true
XTerm.*saveLines: 128
XTerm.*cursorColor: red

The settings shown above give a blue background to the X windows clock, set the xterm font to rom14, turn on a scrollbar, save 128 scrolled lines and set the cursor colour to red.


C.2.2

The following settings will set all backgrounds for the Topog_Display application to green, except the button box widget and its children (buttons at bottom of the control panel), which will be red.

Profile.*background: green
Profile.*button_box.background: red


C.2.3

Some resources for Topog_Display are:

Display.pic.background: black
Display.pic.foreground: white
Display.pic.annotation.fonts:rom7,rom8,rom10,rom11,rom14,rom16
Display.control.button.background: red
Display.control.button.foreground: yellow

These set the display graphics window background to black, the foreground (usually the text colour) to white, the list of fonts to select from for annotations to those named, the control panel foreground to yellow. These are the values you will normally see when Topog_Display starts up.


C.2.4

To make the graphics window black on white, you would use the following setings possibly in the .Xdefaults file:

Display.pic.foreground: black
Display.pic.background: white


C.2.5

Some resources for Topog_Profile are:

Profile.*title: CSIRO Land and Water
Profile.*geometry: =800*800+30+20
Profile.*control.title: Topog
Profile.*control.geometry: =+850+20
Profile.*button_box.legend.labelString: Legend
Profile.*button_box.cursor.labelString: Cursor

The title resources set window titles, the labelString resources set the text for labels, in this case the labels for the buttons on the control panel. The geometry resource for a window has the format =x*y+width+height. If the x*y is omitted, then a default x,y position is used, otherwsie the top left corner of the window is positioned at the specified coordinates, and the window is sized to the given height and width, if possible. It is possible to specify geometry for any widget of a Motif application using the resource names x, y, width and height. This should not be mixed with the geometry resource for a window, but can be specified for widgets which are children of such a window. Examples of this style of geometry are:

Profile.*x: 100
Profile.*y: 100
Profile.*width: 300
Profile.*height: 300

To change the appearance of something in an application, look in the application's default resource file in /usr/lib/X11/app-defaults, and try to find the resource which is apropriate. Copy this resource (not the whole file) into the resource file you wish to use, .Xdefaults for instance, and change the resource value. Then run the application and see what effect the new resource has. On some systems, it is necessary to logout and login again for the new resource to take effect. So if your changes do not seem to work, this may be necessary.

Take me out of frames ....on to Appendix D

last modified on 14 June 1997