MH & nmh: Email for Users & Programmers

May, 2006

X Resources
by Brent Welch

The X resource database is used as a repository of Preference settings, window positions, and definitions of fonts, colors, buttons, and menus. The information in the database can come from a variety of sources, which can be confusing. The default values come from the app-defaults file in the exmh script library directory. Color-specific resources are contained in the files app-defaults-color (for color displays) or app-defaults-mono (for monochrome). Each user also has a ~/.exmh-defaults file. To handle personal color-specific resources, exmh also reads your ~/.exmh-defaults-color or ~/.exmh-defaults-mono if they exist.

I don't recommend putting exmh-related resource settings in your ~/.Xdefaults file, although you can do that. If you do, be warned that values from the ~/.Xdefaults file and the RESOURCE_MANAGER property on the root window are overridden by entries in your ~/.exmh-defaults file.

The ~/.exmh-defaults file is divided into sections. The first section is for things you add by hand. The remaining sections are automatically managed by exmh. If you manually add settings to your ~/.exmh-defaults file, add entries to the beginning of this file. You won't lose your changes if you add them before this line:

    !!! Do not edit below here
    
If a resource value has more than one word, you should not quote the value in the resource file. The next example shows how to specify these in your ~/.exmh-defaults file -- look at the entry for violet red. The leading asterisk (*) works around quirks in the way Tk names its applications -- different instances of the application have different names:
    *scrollbarSide:	left
    *c_current: violet red
    
Finally, if you are really serious about fiddling with resources, you should look through the app-defaults file. For one thing, there's no guarantee that the resource names used in this chapter, which correspond to version 1.5, will be exactly the same in later versions of exmh. Furthermore, there might be new goodies in future versions that aren't described here. Only by reading the app-defaults file of the current version will you be sure you've set things correctly in your ~/.exmh-defaults file. (Hint: To find the app-defaults file, read through the main exmh script for the definition of the exmh(library) Tcl variable, which defines the script library where app-defaults lives. The script is short; the definition is near the beginning.)