SfinxLite TWM - m4 preprocessed file
There are three clear benefits of using the .twmrc.m4
file:
- You can choose between
twm
and ctwm
and still
use the same configuration file.
- 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.
- 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.
- OLDSFINX: if this is defined, and it has a value of
'1', the menu layout and some other values will mimic those of the
OldSfinx system, i.e.: Client Menu on left mouse button, Control menu on
middle mouse button and Host Menu on right mouse button.
If it is not set, the SfinxLite menu layout will be used, with one main
menu under the right mouse button (following the same philosophy used in
OpenWindows, and many other systems: when you start putting menus under
all mouse buttons, with all Control-Shift-Alt combinations, you might
just as well use function keys and call it WordPerfect ;-).
In other words: now a user only has to remember: right button = menu, and
then all choices are shown on the screen).
- BUTTONSTYLE: this defines the style used for the buttons
in the window title bar. The following values are meaningful
- TWM_STYLE: (the default) a "iconify" button on the left, and a
"resize" button on the right.
[
TITLE
]
- MWM_STYLE: a "menu" button (looking like a small bar) on the left,
and "minimize" (iconify) and "maximize" (full screen zoom) buttons
on the right (looking like a small and a big square, respectively).
[
TITLE
]
[MWM is the Motif Window Manager, available on HP and IBM]
- OLWM_STYLE: a "menu" button (a downward pointing triangle) on the
left.
[
TITLE ]
[OLWM is the OpenLook Window Manager, available as part of
OpenWindows on Sun]
- MSWIN_STYLE: A MS-Windows (3.1) look, with a "menu" button on the
right (bit of text) and "minimize" (iconify) and "maximize" (full
screen zoom) buttons on the right (looking like downward and upward
pointing triangles; note that the "maximize" button does not change
shape when the window is maximized. Sorry.).
[
TITLE
]
- USETHREED: if defined (and set to 1), the
ctwm
3D look will be activated. This looks a lot like
Motif and/or OpenWindows; try it and see for yourself.
(but alas, plain TWM doesn't have this feature, only the enhanced CTWM
program has it)
- BORDERRESIZE: this value is only useful in combination
with the 3D look; the 3D look gives window frames separate corners, like
the "resize-corners" under Motif and OpenWindows. This macro takes care
of the actual functionality of these borders: if unset (or 0), the
borders may look like resize-borders, but they are just plain TWM
borders. But when this value is set to 1, the cursor will change shape
when on a window border, and pressing and dragging the left or middle
mouse button will resize the window.
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:
- Make sure to provide a way to get back to iconified windows; if you list
anything in "IconManagerDontShow", the same entry should also go into
"DontIconifyByUnmapping", or else you will have a problem.
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