SfinxLite TWM - m4 preprocessed file

There are three clear benefits of using the .twmrc.m4 file:
  1. You can choose between twm and ctwm and still use the same configuration file.
  2. Using a few well-chosen define() statements, you can switch between the OldSfinx and SfinxLite looks, as well as switching between various title-bar styles (MWM-like, OpenWindows-like or plain TWM). If you are using ctwm, enabling the 3D features is also a very easy matter.
    Other such macros will probably be added when the need arises.
  3. Using include() statements, the largest part of the OldSfinx xtwmrc system can be duplicated: The user initially gets the main file, which includes functions, key-bindings, mouse-bindings and menus from the SfinxLite files.
    This gives you the best of two worlds: easy customization for those who want that, and the benefit of system files, that get updated for all users at once in case something changes in the workstation environment (e.g. new machines added to the host menu, or new data reduction packages).
Click here to take a look at the well-documented template .twmrc.m4 file.

Ways to customize .twmrc.m4

1. Build-in define() statements

Currently, there are 4 macro definitions at the start of .twmrc.m4 that can be used for easy customization (more may be added in the near future). By changing any of these, the user can change a set of related items in order to obtain a certain look and feel.

2. Changing keyword settings

The biggest part of the default .twmrc.m4 file is taken up by settings of keywords that control the general behaviour of TWM. These are grouped by function, to make it easier to find related keywords. The user is free to modify any of these at will. Read the TWM (or CTWM) manual page for more information.

A few caveats:

3. Adding to existing menus

The default .twmrc.m4 file includes all the titles of the menus, using an include() preprocessor command to get the actual contents of the menu. This syntax allows a user to make private additions to the menu, either above or below the standard model. So, if one wants to put a favorite host, e.g. hydrogen, at the top of the menu for easy selection, and add a few remote hosts at the bottom, the Host Menu will look like this:
menu "Hosts"
{
"Hosts"             f.title
"hydrogen"          ! "Xterm hydrogen &"
include(SYSTEMTWM/host.menu)
"rzmws0"            ! "Xterm rwmws0.nfra.nl -l sfinxtst &"
"menehune"          ! "Xterm menehune.jach.hawaii.edu &"
"poliahu"           ! "Xterm -n poliahu -T poliahu -e telnet poliahu.submm.caltech.edu &"
}

4. Adding new menus

Of course, any of the additional menu entries may refer to a separate menu, which should then be provided by the user (we suggest you place them at the end of .twmrc.m4). E.g.:
menu "Mail"
{
"Mail"                  f.title
include(SYSTEMTWM/mail.menu)
"Xmailflag"             f.menu "Control Xbiff"
}

menu "Control Xbiff"
{
"Xmailflag controls"    f.title
"Show mailflag"         ! "Xappl strw xmailflag &"
"Mail reader on"        ! "Xappl strw xmailflag -read &"
"Mail reader off"       ! "Xappl strw xmailflag -dontread &"
}

5. Changing existing menus

The methods mentioned above allow the user to go a long way in customizing the behaviour of TWM, but some users want to go further, e.g. changing commands in existing menus, rearranging top-level menus and so on.

To do this, just include the file you want to edit into your own .twmrc.m4 file, and remove the include() command.

The SfinxLite include files can be found in $OSdir/lib/twm.

6. Taking full control yourself

If you want full control over your menus, just include all of the SfinxLite files, as described above. Or make the m4 preprocessor do the work, by typing:
m4 .twmrc.m4 > .twmrc
After that, rename .twmrc.m4 (because SfinxLite prefers it over .twmrc if it exists), and from then on, TWM will use your own file.

Of course you will loose the benefit of system menus that get updated automatically when something changes in the Observatory workstation environment...



David.Jansen@strw.leidenuniv.nl
Last modified: Fri Sep 15 13:59:46 MET DST 1995