Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ twm(1) — NEWS-os 3.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

X(1)

Xserver(1)

TWM(1)  —  UNIX Programmer’s Manual

NAME

twm - a window manager for X11 (Tom’s Window Manager)

SYNTAX

twm [-display display] [-singlescreen] [-f initfile ]

DESCRIPTION

Twm is a window manager for the X Window System.  Some of its special features include:  title bars, several forms of icon management, user-defined macro functions, click-to-type and pointer-driven keyboard focus, and user-specified pointer and key bindings. 

By default, application windows are surrounded by a “frame” consisting of a title bar at the top and a special border around the window.  The title bar contains the window’s name, a rectangle that is lit when the window is receiving keyboard input, and several function “buttons”. 

Pressing the left-most button in the title bar (which looks like an X in a box) causes the window to be iconified.  In addition to the common picture and text style of icons (with manual or automatic layout), twm supports menus-oriented lists of windows called “icon managers” that use less screen space and are easier to manipulate. 

Pressing the right-most button (which looks like a group of nested squares) and touching one or more edges of the window while the button is still down causes a rubber band representing the outline of the window to appear.  When the button is released, the window will be resized to fit the rubber band. 

OPTIONS

-display display
Specifies the X server to contact.

-singlescreen
Indicates that only a single screen should be managed by twm.  By default, twm attempts to manage each unmanaged screen of the specified display. 

CUSTOMIZATION

Much of twm’s appearance and operation may be customized.  When twm starts executing, it will use the first file that it finds in the list below for each screen of the display:

$HOME/.twmrc.screennumber
The screennumber is a small positive number (e.g. 0, 1, etc.)  representing the screen number (e.g. the last number in the DISPLAY environment variable host:displaynum.screennum) that would be used to contact that screen of the display. 

$HOME/.twmrc
If no special handling is desired for multi-screen displays, the user’s startup file should be named .twmrc in the home directory. 

/usr/lib/X11/twm/system.twmrc
If neither of the preceeding files are found, twm will look for a default configuration.  This is often tailored by the site administrator to provide convenient menus or familiar bindings for novice users. 

The twm startup file has three logical sections: the variables section, the buttons section, and the menus section.  The variables section must come first, followed by either the buttons section or the menus section. 

All variables and keywords may be entered in any combination of upper and lower case letters.  Functions must be entered in lower case. A pound sign (#) character in the startup file indicates a comment which is terminated by the newline character.  A string in the startup file is a series of characters enclosed by double quotes. 

VARIABLES SECTION

Variables must be entered first, at the top of the startup file.  Variables are initialized only once, when twm begins execution.  They will not be affected when a subsequent f.twmrc function is executed.  It is probably a good idea to initialize the color variables first. 

Several variables take filenames as arguments.  Filenames are processed as follows.  twm checks to see if the first character in the filename is a tilde (~), if it is, twm prepends the user’s HOME environment variable to the filename.  In the case of variables requiring bitmap files, if the above expansion does not produce a path to a valid bitmap file, the following steps are taken.  If the IconDirectory variable has been set, and the filename does not start with a slash (/), the IconDirectory variable is prepended to the filename.  If that path does not produce a valid bitmap file, the string "/usr/include/X11/bitmaps/" is prepended to the original filename. 

The following describes the twm variables:
 

AutoRaise { list }
This variable is a list of window names that will automatically raise to the top of the stacking order whenever the pointer enters the window. See also the f.autoraise action below.  The window names in the list are the first characters in the window name to check for.  For example:

AutoRaise
{
"xterm"
"xclock"
}

The above list contains two names which will match window names beginning with the string "xterm" or "xclock".  The following window names will match and be in auto-raise mode: "xterm", "xterm_iguana", "xclock".

AutoRelativeResize
This variable instructs twm to automatically begin rubberbanding whenever resizing is done, rather than waiting for the pointer to cross a window boundary.  When a window is initially mapped, pressing Button2 with this option enabled will cause the rubber band to appear with the lower right hand corner attached to the pointer (as if the lower right hand corner of the window had been crossed).  Similarly, when resizing an already mapped window, this option causes the rubberbanding to begin immediately with the closest end or corner.  If the resize is started in the center of the window, twm will wait for the pointer to cross an edge even if this option is set. 

BorderColor string [ { list } ]
This variable sets the color of the border to placed around all non-iconified windows. It can only be specified inside of a Color or Monochrome list.  The string specifies the default color,  the optional list contains window names and colors so that client specific colors can be specified.  For example:

BorderColor "red"
{
"xclock""blue"
"xterm""green"
}

This example specifies a default border color of red and a border color of blue for all windows named "xclock" and a border color of green for all windows named "xterm". The default  is "black".

BorderTileForeground string [ { list} ]
This variable sets the foreground color of the "grey" bitmap used in non-highlighted borders. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default  is "black". 

BorderTileBackground string [ { list} ]
This variable sets the background color of the "grey" bitmap used in non-highlighted borders. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default  is "white". 

BorderWidth pixels
This variable specifies the width in pixels of of the border surrounding all windows. The default is 2.

ButtonIndent pixels
This variable specifies the amount by which title bar buttons should be indented on all size.  Positive values cause the buttons to be smaller than the window text and highlight area.  The default is 1.

ClientBorderWidth
This variable causes twm to use a window’s border width for the border width of the frame.  The BorderWidth variable is still used for the borders of windows created by twm. 

Color { colors }
This variable is a list of color assignments to be made if the default display has a depth greater than one, or in other words, has the ability to display more than black and white. For example:

Color
{
BorderColor"red"
TitleForeground"yellow"
TitleBackground"blue"
}

The various color variables may be found in this section of the manual page.  There is also a Monochrome list of colors that may be specified.  This enables you to use the same initialization file on a color or monochrome display. 

ConstrainedMoveTime milliseconds
This variable specifies the length of time between button clicks when beginning a constrained move operation.  This value should be set to 0 to disable constrained moves.  The default is 400 milliseconds.

Cursors { cursors }
This variable is a list of cursors that define the appearance of the pointer cursor while it is in the various twm windows.  Each cursor may be defined either from the cursor font or from two bitmap files.  If the desired cursor shape is in the cursor font, then the syntax of the cursor entry is as follows:

Cursor"string"

Where Cursor is one of the cursor names listed below, and string is the name of the cursor from the cursor font.  Valid cursor font names may be found in the file /usr/include/X11/cursorfont.h.  Simply remove the "XC_" prefix from an entry in cursorfont.h and use the remaining string to select the cursor shape.  If the cursor is to be defined from bitmap files then the syntax for a cursor entry is as follows:

Cursor"image""mask"

Where Cursor is again, one of the cursor names listed below.  The image parameter is the image bitmap of the cursor.  The mask parameter is the mask bitmap for the cursor which defines which pixels in the image bitmap will be displayed.  The bitmap files are searched for in the same manner as icon bitmap files.  The following example shows the default cursor definitions and where and/or when the cursor is displayed:

Cursors
{
Frame"top_left_arrow"# window frame
Title"top_left_arrow"# title bar
Icon"top_left_arrow"# icon
IconMgr"top_left_arrow"# icon managers
Move"fleur"# during window movement
Resize"fleur"# during window resizing
Menu"sb_left_arrow"# in a pop up menu
Button"center_ptr"# in title and iconmgr buttons
Wait"watch"# when twm is busy
Select"dot"# waiting to select a window
Destroy"pirate"# following f.destroy
}

DecorateTransients
This variable causes twm to put a title bar on transient windows.  By default, transient windows will not be re-parented. 

DefaultFunction function
This variable defines a default window manager function to be performed if no function is assigned to a combination of modifier keys and mouse buttons.  A useful function to execute might be f.beep. 

DontIconifyByUnmapping { list }
This variable is a list of windows to not iconify by simply unmapping the window.  This may be used when specifying IconifyByUnmapping to selectively choose windows that will iconify by mapping an icon window. 

DontMoveOff
If this variable is set, windows will not be allowed to be moved off the display.

ForceIcons
This variable is only meaningful if a Icons list is defined.  It forces the icon bitmaps listed in the Icons list to be used as window icons even if client programs supply their own icons.  The default is to not force icons. 

FramePadding pixels
This variable specifies the distance between the title bar decorations (the button and text) and the window frame.  The default is 2 pixels.

Icons { list }
This variable is a list of window names and bitmap filenames to be used as icons. For example:

Icons
{
"xterm""xterm.icon"
"xfd""xfd_icon"
}

The names "xterm" and "xfd" are added to a list that is searched when the client window is reparented by twm.  The window names specified are just the first portion of the name to match.  In the above example, "xterm" would match "xtermfred" and also "xterm blob".  The client window names are checked against those specified in this list in addition to the class name of the client if it is specified.  By using the class name, all xterm windows can be given the same icon by the method used above even though the names of the windows may be different. 

IconBackground string [ { list } ]
This variable sets the background color of icons. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "white". 

IconBorderColor string [ { list } ]
This variable sets the color of the border around icons. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "black". 

IconDirectory string
This variable names the directory in which to search for icon bitmap files.  The default is to have no icon directory.

IconFont string
This variable names the font to be displayed within icons.  The default is "8x13".

IconForeground string [ { list } ]
This variable sets the foreground color of icons. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "black". 

IconifyByUnmapping [ { list } ]
This variable causes twm to iconify windows by simply unmapping them.  The icon window will not be made visible.  The optional list is a list of window names to iconify by unmapping.  This list may be used if only certain windows need to be iconified in this manner.  This variable can be used in conjunction with the DontIconifyByUnmapping list.  The default is to iconify by unmapping the window and mapping a seperate icon window. 

IconManagerBackground string [ { list } ]
This variable sets the background color for icon manager entries. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "white". 

IconManagerDontShow [ { list } ]
If this variable is specified alone, no windows will appear in the icon manager. The optional list is a list of window names that will not be displayed in the icon manager window.  This may be useful in specifying windows that are rarely iconified such as "xclock."

IconManagerFont string
This variable names the font to be displayed within icon managers.  The default is "8x13".

IconManagerForeground string [ { list } ]
This variable sets the foreground color for icon manager entries. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "black". 

IconManagerGeometry string [ columns ]
This variable sets the geometry of the icon manager window.  The string is of the form:

    =<width>x<height>{+-}<xoffset>{+-}<yoffset>

The height of the icon manager window is not very important because the height of the window will be changing as windows are created and destroyed.  The optional columns argument is the number of columns to display in the icon manager.  The width of each column will be the width of the icon manager window divided by the number of columns.  The default number of columns is one. 

IconManagerHighlight string [ { list } ]
This variable sets the highlight color for the icon manager entries. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "black". 

IconManagers { list }
This variable is a list of icon managers to create.  Each item in the list has the following format:

"name" ["icon name"]"geometry" columns

The name field is a double-quoted string containing the name of this icon manager.  The name will be used to match client applications to a specific icon manager.  For example:

IconManagers
{
"XTerm""=300x5+800+5" 5
"myhost""=400x5+100+5" 2
}

This sample will create two new icon managers called "XTerm" and "myhost". Client programs whose name or class is "XTerm" will have an entry created in the "XTerm" icon manager.  Likewise with clients named "myhost".  If you were to create an xterm that had a name of "myhost".  It would be placed in the "myhost" icon manager rather than the "XTerm" icon manager. The optional argument icon name specifies the name to be associated with the icon when the icon manager is iconified.  The geometry is a standard X geometry string which will provide the position and the size of the icon manager.  The columns argument is the number of columns to display in the icon manager.  A column’s width will be the width of the icon manager divided by the number of columns. 

IconManagerShow { list }
This variable is a list of windows you wish to appear in the icon manager.  When used in conjunction with the IconManagerDontShow variable, only windows in this list will be shown in the icon manager. 

IconRegion “geometry” grav-a grav-b x-space y-space
This is more a command than a variable, as multiple IconRegions may be specified.  An IconRegion is an area of the root window in which icons are placed if no specific position is given.  grav-a specifies the way in which icons are placed in the area, NORTH gravity attempts to bunch icons at the top of the window, similarly for the other 3 cardinal directions.  grav-b specifies a secondary ordering, and should be orthogonal to grav-a.  x-space and y-space create a grid within the icon region which icons are bound to, this tends to organize the icons in neat rows/columns.

InterpolateMenuColors
This variable causes menu entry colors to be interpolated between entry specified colors.  For example:

Menu "foo"
{
"Title"("black":"red")f.title
"entry1"f.nop
"entry2"f.nop
"entry3"("white":"green")f.nop
"entry4"f.nop
"entry5"("red":"white")f.nop
}

If InterpolateMenuColors had been specified, "entry1", and "entry2" would have forground colors interpolated between black and white and a background colors interpolated from red to green.  The entry named entry4 would have a forground color half way between white and red and a background color half way between green and white. 

MakeTitle { list }
This variable is a list of windows on which a title bar should be placed. This variable, used in conjunction with the NoTitle variable enables you to create a list of windows which will have a title bar. 

MenuBackground string
This variable sets the background color of menus. It can only be specified inside of a Color or Monochrome list.  The default is "white". 

MenuFont string
This variable names the font to be displayed within menus.  The default is "8x13".

MenuForeground string
This variable sets the foreground color of menus. It can only be specified inside of a Color or Monochrome list.  The default is "black". 

MenuShadowColor string
This variable sets the color of the shadow behind pull-down menus. It can only be specified inside of a Color or Monochrome list.  The default is "black". 

MenuTitleBackground string
This variable sets the background color for f.title entries in menus.  It can only be specified inside of a Color or Monochrome list.  The default is "white". 

MenuTitleForeground string
This variable sets the foreground color for f.title entries in menus.  It can only be specified inside of a Color or Monochrome list.  The default is "black". 

Monochrome { colors }
This variable is a list of color assignments to be made if the default display has a depth equal to one, or in other words can only display black and white pixels. For example:

Monochrome
{
BorderColor"black"
TitleForeground"black"
TitleBackground"white"
}

The various color variables may be found in this section of the manual page.  There is also a Color list of colors that may be specified.  This enables you to use the same initialization file on a color or monochrome display. 

MoveDelta pixels
This variable is the number of pixels the pointer must move before the f.move function starts working.  The default is zero pixels. 

NoBackingStore
twm menus attempt to use backing store to minimize menu repainting.  If your server has implemented backing store but you would rather not use this feature, this variable will disable twm from using backing store. 

NoGrabServer
If this variable is specified, twm will not grab the server when performing certain operations.  By default, twm will grab the server when necessary. 

NoHighlight [ { list } ]
This variable turns off border highlighting. An optional list may be specified with window names to selectively turn off border highlighting.  The default is to highlight the borders of all windows when the cursor enters the window.  When the border is highlighted, it will be drawn in the current BorderColor.  When the border is not highlighted, it will be rendered with a "grey" bitmap using the current BorderTileForeground and BorderTileBackground colors. 

NoMenuShadows
If this variable is specified, menus will not have shadows drawn behind them. This options speeds up drawing of menus, which is useful for slower machines.

NoRaiseOnDeiconify
If this variable is specified, windows will not be raised to the top of the stacking order when de-iconified.

NoRaiseOnMove
If this variable is specified, windows will not be raised to the top of the stacking order following a move.

NoRaiseOnResize
If this variable is specified, windows will not be raised to the top of the stacking order following a resize.

NoSaveUnder
twm menus attempt to use save unders to minimize window repainting following menu selections.  If your server has implemented save unders but you would rather not use this feature, this variable will disable twm from using save unders. 

NoTitle [ { list } ]
This variable is a list of window names that will NOT have a title bar created for them.  If NoTitle is specified with no window name list, twm will not put title bars on any windows.  The list of windows and how they match window names is exactly like the AutoRaise variable described above. 

NoTitleFocus
If this variable is specified, input focus will not be directed to windows when the pointer is in the title bar.  The default is to focus input to a client when the pointer is in the title bar.

NoTitleHighlight [ { list } ]
This variable turns off title bar highlighting. An optional list may be specified with window names to selectively turn off title bar highlighting.  The default is to highlight the title bar of all windows when the cursor enters the window.

NoVersion
This variable tells twm to not display the version window when starting up.  The default is to display a window containing the version number when twm finishes initialization.  If this variable is set, it is still possible to see the version window by using the f.version function. 

OpaqueMove
This variable causes the f.move function to drag the window around on the display rather than an outline of the window. 

Pixmaps { pixmaps }
This variable is a list of pixmaps that define the appearance of various images.  Each entry is a keyword indicating which pixmap to set followed by a string giving the name of the bitmap file.  The following pixmaps may be specified:

Pixmaps
{
TitleHighlight"gray1"# for title highlight window
}

The default for TitleHighlight is to use a set of horizontal stripes (but, a gray pattern is much better for interlaced monitors). 

RandomPlacement
This causes windows with no specified geometry to be placed on the display in a random (kind of) position when they are created.  The default is to allow the user to position the window interactively.

ResizeFont string
This variable names the font to be displayed in the dimensions window during window resize operations. The default is "fixed".

RestartPreviousState
This causes twm to attempt to use the WM_STATE property on client windows to tell which windows should be iconified and which should be left visible.  If this variable is not set, the window manager will use the WM_NORMAL_HINTS to determine the desired initial state of each window. 

StartIconified [ { list } ]
This variable is a list of window names that will be started up iconified. It is useful for programs that do not support the Xt "-iconic" flag yet. The list of windows and how they match window names is exactly like the AutoRaise variable described above. 

TitleFont string
This variable names the font to be displayed within the window title bar.  Note that the title bar is only 17 pixels in height, so the largest practical font would be something like "9x15". The default is "8x13".

ShowIconManager
This variable causes the icon manager window to be displayed when twm is started.  The default is to not display the icon manager window.

SortIconManager
This variable causes entries in the icon manager to be sorted alphabetically. The default is to simply add new windows to the end of the icon manager.

TitleBackground string [ { list } ]
This variable sets the background color for the title bars. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "white". 

DefaultForeground string
This variable sets the foreground color to be used for twm sizing windows, etc.  The default is "black".

DefaultBackground string
This variable sets the background color to be used for twm sizing windows, etc.  The default is "white".

TitleForeground string [ { list } ]
This variable sets the foreground color for the title bars. It can only be specified inside of a Color or Monochrome list.  The optional list is a list of window names and colors so that client specific colors may be specified.  See the BorderColor variable for a complete description of the list.  The default is "black". 

TitlePadding pixels
This variable specifies the distance between the various buttons, text, and highlight areas in the title bar.  The default is 8 pixels.

UnknownIcon string
This variable specifies the file name of a bitmap format file to be used as the default icon.  This bitmap will be used for the icon of all clients which do not provide an icon bitmap and are not listed in the Icons list.  The default is to use no bitmap. 

UsePPosition string
This variable specifies how twm should deal with laying out windows for which the default position was specified by the application and not the user (i.e. PPosition was set in the size hints instead of USPosition).  The string may have three values:  "off" (the default) indicating that twm should ignore the program-supplied position, "on" indicating that the position should be used, and "non-zero" indicating that the position should used if it is other than (0,0).  The latter option is for working around a bug in older toolkits. 

WarpCursor
This variable causes the pointer cursor to be warped to a window which is being deiconified.  The default is to not warp the cursor.

WindowFunction function
This variable specifies the function to perform when a window is selected from the TwmWindows menu.  If this variable is not set, a window selected from the TwmWindows menu will be deiconified (if it is an icon) and then raised to the top of the window stacking order. 

XORValue number
This variable specifies the value to use when drawing temporary lines when resizing or moving a window.  The default is to use a value that causes colors at the opposite end of the colormap to be displayed.  However, if your default colormap tends to have distinct colors next to one and another, setting this variable to 1 or 15 (make sure the low bit is set if you are using a monochrome display) often yields nice results.

Zoom [ count ]
This variable causes a series of outlines to be drawn when a window is iconified or deiconified.  The optional count is a number which will be the number of outlines to be drawn. The default is to not draw the outlines.  The default outline count is 8.

BUTTONS SECTION

The buttons section of the startup file contains definitions of functions to perform when pointer buttons or specific keyboard keys are pressed.  Functions are assigned either to a pointer button, a keyboard key, or a menu entry.  Functions are assigned to pointer buttons as follows:

Buttonn = keys : context :  function

The n following Button can be a number between 1 and 5 to indicate which pointer button the function is to be tied to. The keys field is used to specify which modifier keys must be pressed in conjunction with the pointer button.  The keys field may contain any combination of the letters s, c, and m, which stand for Shift, Control, and Meta, respectively.  The context field specifies the context in which to look for the button press.  Valid contexts are: icon, root, title, frame, window, iconmgr, and all.  The all context allows you to execute a function no matter where the cursor is positioned on the screen.  Shorthand specifications for the contexts may be specified similar to the keys field by using the following letters: r for root, f for frame, t for title, w for window, i for icon, and m for iconmgr.  The function field specifies the window manager function to perform.  Now for some examples:

Button2 =: title: f.move# 1
Button1 =: root: f.menu "menu 1"# 2
Button1 = m: icon: f.menu "icon menu 1"# 3
Button3 = msc: window: f.menu "menu3 1"# 4
Button3 = : twfm: f.raise# 5

Line 1 specifies that when pointer button 2 is pressed in the title bar with no modifier keys pressed, the f.move function is to be executed.  Line 2 specifies that when pointer button 1 is pressed in the root window with no modifier keys pressed, the menu "menu 1" is popped up.  Line 3 specifies that when pointer button 1 is pressed in an icon window with the meta key pressed, the menu "icon menu 1" is popped up.  Line 4 specifies that when pointer button 3 is pressed in a client window with the shift, control, and meta keys pressed, the menu "menu 3" is popped up.  Line 5 specifies that when the pointer is in the title bar, window, frame, or icon manager entry and a button is pressed, the associated window should be raised to the top of the stacking order. 

Function Key Specifications

twm allows you execute functions when any key on the keyboard is pressed.  The specification of a function key is exactly like the button specification described above, except instead of Button[1-5], a function key name in double quotes is used.  In addition to the normal contexts that may be specified, a window name may be used, and the function will be applied to all windows matching the name.  For example:

"F1"=: window: f.iconify
"F2"= m: root: f.refresh
"F3"= m: "window_name": f.iconify
"Up"=: iconmgr: f.upiconmgr
"Down"=: iconmgr: f.downiconmgr

Keyboard key names can be found in /usr/include/X11/keysymdef.h.  Simply remove the XK_ and you have the name that the X server will recognize.  The iconmgr context is particularly useful for keyboard functions.  A function such as f.raise executed in an icon manager entry from a keyboard key will cause the window to be raised.  Functions such as this, used in conjunction with the f.<up,down,left,right>iconmgr functions allow you to configure an environment where you can raise, lower, iconify, deiconify, and change the input focus of windows without ever moving your hands from the keyboard. 
 

TWM Functions

! stringThis function causes string to be sent to /bin/sh for execution.  In multiscreen mode, if string starts a new X client without giving a display argument, the client will appear on the screen from which this function was invoked. 

^ stringThis function causes string followed by a new line character to be placed in the window server’s cut buffer. 

f.autoraise
This function toggles the auto_raise attribute of a window.  Windows with this attribute rise to the top of the stacking order whenever the cursor enters them.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window whose attribute is changed.  Windows that match any of the names in the AutoRaise list initially have this attribute set (see description of the AutoRaise variable above).  Other windows initially have this attribute turned off. 

f.backiconmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is warped to the previous icon manager entry in the current icon manager.  The previous entry means warping to the previous column or the last column of the previous row if the current entry is in the first column.

f.beepThis function causes the bell of the workstation to be sounded. 

f.bottomzoom
This function is similar to the f.fullzoom function, but resizes the to fill the bottom half of your screen.  It is also a toggle function like f.iconify and f.fullzoom.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is zoomed/unzoomed. 

f.circledown
This function causes the top window that is obscuring another window to drop to the bottom of the stack of windows.

f.circleup
This function raises the lowest window that is obscured by other windows.

f.cutfileThis function takes the contents of the window server’s cut buffer and uses it as a filename to read into the server’s cut buffer. 

f.deleteThis function asks the client application to remove the indicated window if the window has subscribed to the WM_DELETE_WINDOW window manager protocol.  If the indicated window is an icon manager, twm will hide it.  If the window does not have WM_DELETE_WINDOW in its WM_PROTOCOLS list, the bell will be wrung and no action taken. 

f.deiconify
This function deiconifies a window.  If the window is not an icon, this function does nothing. If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is deiconified. 

f.deltastop
This function allows you to abort a user-defined function if the pointer has been moved more than MoveDelta pixels.  This is useful for emulating the "move-or-raise" semantics provided by other window managers:

Function "move-or-raise"
{
    f.move
    f.deltastop
    f.raise
}
 Button3 = m : window|icon|frame|title : f.function "move-or-raise"

f.destroy
This function allows you to destroy a window client. If executed from a menu, the cursor is changed to the Destroy and the next window to receive a button press will be destroyed. 

f.downiconmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is moved to the next entry in the icon manager.  If the pointer is in the bottom entry, it is warped to the top entry.  This function allows changing the current keyboard focus without using the mouse.

f.file string
This function assumes string is a file name.  This file is read into the window server’s cut buffer. 

f.focusThis function implements the same function as the keyboard focus button in the title bar.  If executed from a menu, the cursor is changed to the Select cursor and the next window to receive a button press will gain the input focus. 

f.forcemove
This function allows you to move a window.  If DontMoveOff is set, f.forcemove allows you to move a window partially off the display.  If executed from a menu, the cursor is changed to the Move cursor and the next window that receives a button press will be the window that is moved. 

f.forwiconmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is warped to the next icon manager entry in the current icon manager.  The next entry means warping to the next column or the first column of the next row if the current entry is in the last column.

f.fullzoom
This function resizes the current window to the full size of your display. It is a toggle function so it is really a fullzoom/unfullzoom function. In order to undo the fullzoom, you invoke f.fullzoom again - similar to f.iconify.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is fullzoomed/unfullzoomed. 

f.function string
This function executes the user defined function stream specified by string.  A function stream is zero or more twm functions that will be executed in order as if they were a single function.  To define a function stream the syntax is:

Function "function name"
{
function
function
  .
  .
function
}

for example:

Function "raise-n-focus"
{
f.raise
f.focus
}

f.hideiconmgr
This function causes the icon manager window to become unmapped (not visible).

f.horizoom
This variable is similar to the f.zoom function but causes the window to be resized to the full width of the display. 

f.iconify
This function implements the same function as the iconify button in the title bar.  If executed from a menu, the cursor is changed to the Select cursor and the next window to receive a button press will be iconified or de-iconified depending on

f.identify
This function pops up a window and displays information about the selected window. If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is selected.  A button press or key press in the information window will cause it to be unmapped. 

f.lefticonmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is moved to the icon manager entry to the left of the current one. If the pointer is in the leftmost entry, it is warped to the rightmost entry in the current row. This function allows changing the current keyboard focus without using the mouse. the current state of the window.

f.leftzoom
This variable is similar to the f.bottomzoom function but causes the window to be resized to the left half of the display. 

f.lowerThis function lowers the window to the bottom of the stacking order.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is lowered. 

f.menu string
This function assigns the pull-down menu named string to a pointer button.  If this function is used as an entry in a pull-down menu a pull-right menu will be assigned to the menu entry. 

f.moveThis function allows you to move a window.  If executed from a menu, the cursor is changed to the Move cursor and the next window that receives a button press will be the window that is moved.  Double clicking the pointer button tied to this function causes a constrained move function to be executed.  The pointer will be warped to the center of the grid.  Moving the pointer to one of the grid lines will cause the window to begin moving in either an up-down motion or a left-right motion depending on which grid line the pointer was moved across. 

f.nexticonmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is warped to the next icon manager which is displayed and has one or more windows listed in it. The next icon manager means the next icon manager in the list of icon managers for this screen or the next visible icon manager on the next screen. This function will wrap around to the current icon manager if it is the only one that is valid.

f.nopThis function does nothing. 

f.previconmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is warped to the previous icon manager which is displayed and has one or more windows listed in it. The previous icon manager means the icon manager preceeding the current one in the list of icon managers for this screen or the previous visible icon manager on the previous screen. This function will wrap around to the current icon manager if it is the only one that is valid.

f.quitThis function causes twm to exit.  There is no function to exit the X Window System from a window manager; at present you must save the X Server’s PID in a variable and send it "kill -TERM".  This can easily be done in TWM by the ! function (see example below). 

f.raiseThis function raises the window to the top of the stacking order.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is raised. 

f.raiselower
This function raises the window to the top of the stacking order if it is obscured in any way.  If the window is unobscured, the window is lowered to the bottom of the stacking order. If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is raised or lowered. 

f.refresh
This function causes all windows to be refreshed.

f.resizeThis function implements the window resize function of the resize button in the title bar.  If executed from a menu, the cursor is changed to the Resize cursor and the next window that receives a button press will be the window that is resized. 

f.restart
This function kills and restarts twm. 

f.righticonmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is moved to the icon manager entry to the right of the current one. If the pointer is in the rightmost entry, it is warped to the leftmost entry in the current row. This function allows changing the current keyboard focus without using the mouse. the current state of the window.

f.rightzoom
This variable is similar to the f.bottomzoom function but causes the window to be resized to the right half of the display. 

f.saveyourself
This function asks the client application to checkpoint all state associated with the indicated window if that window subscribes to the WM_SAVEYOURSELF window manager protocol.  Otherwise, the bell is wrung and no action is taken.

f.showiconmgr
This function causes the icon manager window to become mapped (visible).

f.sorticonmgr
This function must be executed within an icon manager and causes the entries in the icon manager to be sorted.

f.source string
This function assumes string is a file name.  The file is read and parsed as a twm startup file.  This function is intended to be used only to re-build pull-down menus.  None of the twm variables are changed. 

f.titleThis function is to be used as an entry in a pull-down menu.  It centers the menu entry string in a menu entry and outlines it with a border.  This function may be used more than once in a pull-down menu. 

f.topzoom
This variable is similar to the f.bottomzoom function but causes the window to be resized to the top half of the display. 

f.twmrcThis function causes the $HOME/.twmrc file to be re-read.  This function is exactly like the f.source function without having to specify the filename. 

f.unfocus
This function assigns input focus to the root window.

f.upiconmgr
This function is meant to be executed from a keyboard key. When the function is executed, the pointer is moved to the previous entry in the icon manager.  If the pointer is in the top entry, it is warped to the bottom entry.  This function allows changing the current keyboard focus without using the mouse.

f.version
This function causes the twm version window to be displayed.  This window will be displayed until a pointer button is pressed or the pointer is moved from one window to another. 

f.warpto string
This function warps the pointer to the window which has a name or class that matches string. 

f.warptoiconmgr
This function warps the pointer to the icon manager entry which matches associated with the window that the pointer is currently in.

f.warptoscreen string
This function warps the pointer to the indicated screen.  Screens are specified by number (e.g. "0" or "1"), relative to the current screen (i.e. "next" or "prev"), or the most recently visited screen ("back").  The keywords "next" and "back" will wrap and will ignore any unmanaged screens.

f.winrefresh
This function is similar to the f.refresh function, but allows you to refresh a single window.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is refreshed. 

f.zoomThis function is similar to the f.fullzoom function, but resizes the height to the maximum height of your screen, not the width.  It is also a toggle function like f.iconify and f.fullzoom.  If executed from a menu, the cursor is changed to the Select cursor and the next window that receives a button press will be the window that is zoomed/unzoomed. 

MENUS SECTION

The menus section is where pull-down menus are defined.  Entries in menus consist of functions as described in the Buttons Section.  The syntax to define a menu is:

Menu "menu name" [ ("fore":"back") ]
{
string[ ("fore":"back")]function
string[ ("fore":"back")]function
.
.
string[ ("fore":"back")]function
}

The menu name should be an identical string to one being used with an f.menu function.  Note that the menu name is case sensative.  The optional fore and back arguments specify the foreground and background colors used to highlight a menu entry when the pointer enters the menu entry.  These colors will only take effect on a color display.  The default is to invert the foreground and background colors of the menu entry.  The string portion of each menu entry will be the text which will appear in the menu.  The optional fore and back arguments specify the foreground and background color of the menu entry when the pointer is not in the entry.  These colors will only be used on a color display.  The default is to use the MenuForeground and MenuBackground colors.  The function portion of the menu entry is one of the functions described in the previous section. 

There is a special menu called TwmWindows.  This menu contains a list of all windows known to twm.  Selecting one of these window names will cause the WindowFunction to be executed.  If WindowFunction has not been set, the window will be deiconified (if it is an icon) and then raised to the top of the window stacking order. 

ICONS

Icons are no "active" icons.  By this I mean you may now move the pointer onto an icon and type characters from the keyboard and they will be directed to the iconified window. 

ICON MANAGER

An icon manager is a window that contains names of selected or all windows currently on the display.  In addition to the window name, a small "window-pane" iconify button will be displayed to the left of the name when the window is in an iconic state.  If the window is not currently an icon, a pointer button press when the pointer is on the window name will cause the window to be iconified.  If the window is iconic, a pointer button press when the pointer is either on the window name or on the iconify button will by default, cause the window to be deiconified.  These default actions may be changed using the iconmgr context when specifying button and keyboard actions.  Moving the pointer into the icon manager also has the feature of directing the keyboard focus to the window pointed to in the icon manager.  Using the f.upiconmgr, f.downiconmgr f.lefticonmgr, and f.righticonmgr functions allow you to change keyboard focus between windows without moving your hands from the keyboard. 

WINDOW STARTUP

When a client is started, twm does one of twm things.  If the RandomPlacement variable has been set and the window has not specified an initial geometry, the window will be placed in a random (kind of) position the display.  If the RandomPlacement variable has not been set and the client has not specified both User Specified Size hints and User Specified Position hints, twm will put up a rubberband box indicating the initial window size.  If pointer Bbutton1 is pressed, the client window is created with the window position equal to the current pointer position.  If pointer Button2 is pressed, twm allows the window to be resized.  The resizing operation takes place until button two is released.  If pointer Button3 is pressed, the client window is created at the current position, with the height set to the distance to the bottom of the screen and a width clipped to the right edge of the screen.  While the initial positioning of the window is taking place, twm will place a window in the upper-left corner of the display showing the window’s name.  If resizing is taking place, twm will also place a window in the upper-left corner, indicating the current window size. 

EXAMPLES

The following is an example twm startup file:

 #∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
#
#    .twmrc
#
#∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
 WarpCursor
BorderWidth2
TitleFont"8x13"
MenuFont"8x13"
IconFont"8x13"
 Color
{
BorderColor "red"
{
"system1""blue"
"system2""green"
}
BorderTileForeground"blue"
BorderTileBackground "yellow"
TitleForeground "white"
TitleBackground "blue"
MenuForeground "yellow"
MenuBackground "darkgreen"
MenuTitleForeground "red"
MenuTitleBackground "blue"
IconForeground "darkgreen"
IconBackground "cadetblue"
IconBorderColor "green"
}
 #Button = KEYS : CONTEXT : FUNCTION
#----------------------------------
Button1 =: root: f.menu "button1"
Button2 =: root: f.menu "button2"
Button3 =: root: f.menu "button3"
Button1 =  m: window: f.menu "button1"
Button2 =  m: window: f.menu "button2"
Button3 =  m: window: f.menu "button3"
Button1 =  m: title: f.menu "button1"
Button2 =  m: title: f.menu "button2"
Button3 =  m: title: f.menu "button3"
Button1 =: title: f.function "raise-lower-move"
 "Up"    =: iconmgr: f.upiconmgr
"Down"  =: iconmgr: f.downiconmgr
"Left"  =: iconmgr: f.lefticonmgr
"Right" =: iconmgr: f.righticonmgr
 ForceIcons
IconDirectory "~/icons"
Icons
{
"xterm""xterm.icon"# obtained from IconDirectory
"xfd""xfd_icon"# obtained from /usr/include/X11/bitmaps
}
UnknownIcon "default.icon"
 NoTitle
MakeTitle
{
"xterm"# only put tile bars on xterm windows and
"hpterm"# hpterm windows.
}
 # The following lines create a raise/lower/move function
 MoveDelta 5
Function "raise-lower-move"
{
f.move
f.raiselower
}
 # Now for some menus
 menu "button1"
{
"Sun Systems"f.title
"iguana" !"xterm -T iguana =80x24+100+100 -e rlogin iguana &"
"worm"!"xterm -T worm =80x24+100+100 &"
"shiva"!"xterm -T shiva =80x24+200+200 -e rlogin shiva &"
"tegus"!"xterm -T tegus =80x24+200+200 -e rlogin tegus &"
"Vax Systems"f.title
"shade"!"xterm -T shade =80x24+200+200 -e rlogin shade &"
"bilbo"!"xterm -T bilbo =80x24+250+250 -e rlogin bilbo &"
"frodo"!"xterm -T frodo =80x24+300+300 -e rlogin frodo &"
"esunix" !"xterm -T esunix =80x24+350+350 -e rlogin esunix &"
"lynx8"!"xterm -T lynx8 =80x24+390+390 -e rlogin lynx8 &"
}
 menu "button2"
{
"Window Ops"f.title
"Refresh"f.refresh
"Focus on Root"f.unfocus
"Re-read .twmrc"f.twmrc
"Source something"f.source "something"
"twm Version"f.version
"(De)Iconify"f.iconify
"Move Window"f.move
"Resize Window"f.resize
"Raise Window"f.raise
"Lower Window"f.lower
"Focus on Window"f.focus
"Destroy Window"f.destroy
"Exit TWM (only)"f.quit
"Exit X Windows"!"kill -TERM $XTOOLSPID"
}
 menu "button3"
{
"Cut Buffer"f.title
"Procedure Header"f.file "/usr/ias_soft/tlastrange/src/proc.twm"
"File Header"f.file "/usr/ias_soft/tlastrange/src/file.twm"
"pull right"f.menu "blob"
}
 menu "blob"
{
"pull right"f.menu "final"
"another"^"some text"
}
 menu "final"
{
"entry 1"f.nop
"entry 2"f.nop
"entry 3"f.nop
"entry 4"f.nop
}

BUGS

Pull-right menus may still have some problems.  They may sometimes stay around when all pointer buttons have been released. 

Double clicking very fast to get the constrained move function will sometimes cause the window to move, even though the pointer is not moved. 

The window auto-raise feature does not work consistently when the mouse is moved very fast over auto-raise windows. 

FILES

 $HOME/.twmrc.<screen number>
 $HOME/.twmrc
 /usr/lib/X11/twm/system.twmrc

SEE ALSO

X(1), Xserver(1)

COPYRIGHT

COPYRIGHT 1988
Evans & Sutherland Computer Corporation
Salt Lake City, Utah
All Rights Reserved.

COPYRIGHT 1989
Hewlett-Packard Company and the Massachusetts Institute of Technology

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY EVANS & SUTHERLAND, HEWLETT-PACKARD, OR M.I.T..  EVANS & SUTHERLAND, HEWLETT-PACKARD, AND M.I.T.  MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 

IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT SET FORTH ABOVE. 

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the names of Evans & Sutherland, Hewlett-Packard, and M.I.T. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. 

AUTHORS

Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Dave Payne, Apple Computer; Keith Packard, MIT X Consortium

NEWS-OSRelease 3.3

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026