TWM

Section: User Commands (1)
Updated: 6 April 1988
Index Return to Main Contents
 

NAME

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

 

SYNTAX

twm [-display display]

 

DESCRIPTION

The twm program is a window manager client application of the window server.

The twm program was written to try and incorporate some of the desirable features of both the wm and uwm window managers. Twm puts a title bar on and re-parents each window. The title bar contains the window's name and three "buttons". When a pointer button press event is detected in any of these title bar "buttons" a certain action is performed. The left-most title bar button that looks like a window pane causes the window to be iconified. The right-most title bar button with the right-angles is the re-size button. The resize function is identical to the window resize function of the wm window manager. The other title bar button is supposed to represent a keyboard, a button click here causes the input focus to be directed to this window until the f.focus function is executed or another window is selected to get input focus. The title bar has the additional feature of becoming highlighted if the window has the input focus.

When twm is invoked, it attempts to read a twm startup file. The name of the twm startup file is:


  $HOME/.twmrc

The twm startup file can be thought of as having 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. Title functions and Root 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 once when twm begins execution, they will not be effected when a f.twmrc function is executed.

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. 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".

BorderWidth pixels
This variable specifies the width in pixels of of the border surrounding all windows. The default is 2.
IconFont string
This variable names the font to be displayed within icons. The default is "8x13".
MenuFont string
This variable names the font to be displayed within menus. The default is "8x13".
NoTitle { list }
This variable is a list of window names that will NOT have a title bar created for them. If the client does not get ButtonPress events, twm will get them and all Title functions currently in effect will work when pointer buttons are pressed in the client window. The list of windows and how they match window names is exactly like the AutoRaise variable described above.
ResizeFont string
This variable names the font to be displayed in the dimensions window during window resize operations. The default is "fg-22".
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".
ReverseVideo
This variable causes twm to display white characters on a black background, rather than black characters on white.
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. The default is to use no bitmap.
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.

 

BUTTONS SECTION

The buttons section of the startup file contains definitions of functions to perform when pointer buttons are pressed. There are two classes of functions that can be tied to a pointer button: Title functions, which will be executed if a pointer button is pressed while the pointer is in the title bar of a window; and Root functions, which will be executed while the pointer is in the root window or if the client program is not processing pointer button events.

Title functions are assigned as follows:

TitleButtonn t.function
TitleButton is a startup file keyword. The n following TitleButton can be a number between 1 and 5 to indicate which pointer button the function is to be tied to. t.function may be any one of the following title functions.

 

Title Functions

t.lower
This function lowers the window to the bottom of the stacking order.
t.move
This function causes a grid to appear over the window which can be moved to where you want the window to be 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.
t.nop
This function does nothing.
t.raise
This function raises the window to the top of the stacking order.

The defaults for title functions are as follows:

TitleButton1 t.raise
TitleButton2 t.move
TitleButton3 t.lower
TitleButton4 t.nop
TitleButton5 t.nop

Root functions are assigned either to a pointer button or a menu entry. The f.title function is the only one that doesn't really make sense to use as just a button function. It was designed to be used in a pull-down menu. Root functions are assigned to pointer buttons as follows:

Buttonn function
Button is a startup file keyword. The n following Button can be a number between 1 and 5 to indicate which pointer button the function is to be tied to. function may be any one of the following root functions.

 

Root Functions

! string
This function causes string to be sent to /bin/sh for execution.
^ string
This function causes string followed by a new line character to be placed in the window server's cut buffer.
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.cutfile
This 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.file string
This function assumes string is a file name. This file is read into the window server's cut buffer.
f.focus
This function assigns input focus to the root window.
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.nop
This function does nothing.
f.quit
This function causes twm to exit.
f.refresh
This function causes all windows to be refreshed.
f.source string
This funtion 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.title string
This function is to be used as an entry in a pull-down menu. It centers 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.twmrc
This 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.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.

 

MENUS SECTION

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

Menu "menu name"
{
   string    function
   string    function
         .
         .
   string    function
}

The menu name should be an identical string to one being used with an f.menu Root function. Note that the menu name is case sensative. The string portion of each menu entry will be the text which will appear in the menu. The function portion of the menu entry is one of the Root functions described in the previous section.

 

SPECIAL FEATURES

Since the X11 xterm does not provide an icon, twm can provide a reasonable looking one for you. When twm is framing a window it looks at the name of the window to determine if it should add an appropriate icon for xterm windows. The names it looks for are:

xterm
yterm
console
login

If twm finds any of the above names as the first part of the window name, the twm xterm icon bitmap is assigned as the bitmap to display when the window is iconified.

If the window name begins with the string "xterm_", only the portion of the name following the "xterm_" will be displayed as the window name in the title bar. For example: an xterm started with "-T xterm_iguana" would display the name "iguana" in the title bar.

 

EXAMPLES

The following is an example twm startup file:

#**********************************************************************
#
#    .twmrc
#
#**********************************************************************

WarpCursor
UnknownIcon     "/usr/ias_soft/tlastrange/.icon"
BorderWidth     2
TitleFont       "8x13"
MenuFont        "8x13"
IconFont        "8x13"

Button1         f.menu "button1"
Button2         f.menu "button2"
Button3         f.menu "button3"
Button4         f.nop
Button5         f.nop

TitleButton1    t.raise
TitleButton2    t.move
TitleButton3    t.lower
TitleButton4    t.nop
TitleButton5    t.nop

AutoRaise
{
  "xterm"       # all of my xterm windows will auto-raise
}

NoTitle
{
  "xclock"      # don't need a title bar on this ...
  "xckmail"     # or this
}

menu "button1"
{
"Sun Systems"   f.title
"iguana"        !"xterm -T xterm_iguana =80x24+100+100 -e rlogin iguana &"
"worm"          !"xterm -T xterm_worm =80x24+100+100 &"
"shiva"         !"xterm -T xterm_shiva =80x24+200+200 -e rlogin shiva &"
"tegus"         !"xterm -T xterm_tegus =80x24+200+200 -e rlogin tegus &"
"Vax Systems"   f.title
"shade"         !"xterm -T xterm_shade =80x24+200+200 -e rlogin shade &"
"bilbo"         !"xterm -T xterm_bilbo =80x24+250+250 -e rlogin bilbo &"
"frodo"         !"xterm -T xterm_frodo =80x24+300+300 -e rlogin frodo &"
"esunix"        !"xterm -T xterm_esunix =80x24+350+350 -e rlogin esunix &"
"lynx8"         !"xterm -T xterm_lynx8 =80x24+390+390 -e rlogin lynx8 &"
}

menu "button2"
{
"Window Ops"            f.title
"Refresh"               f.refresh
"Focus on Root"         f.focus
"Source .twmrc"         f.twmrc
"Source something"      f.source "something"
"twm Version"           f.version
}

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

Twm needs to deal with color displays at some point. Only monochrome is currently supported.

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.

 

FILES


 $HOME/.twmrc

 

SEE ALSO

X(1), Xserver(1)

 

COPYRIGHT

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

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY EVANS & SUTHERLAND. EVANS & SUTHERLAND MAKES 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 name of Evans & Sutherland not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.  

AUTHOR

Thomas E. LaStrange, Evans & Sutherland, Interactive Systems Division, Salt Lake City, Utah.


 

Index

NAME
SYNTAX
DESCRIPTION
VARIABLES SECTION
BUTTONS SECTION
Title Functions
Root Functions
MENUS SECTION
SPECIAL FEATURES
EXAMPLES
BUGS
FILES
SEE ALSO
COPYRIGHT
AUTHOR

This document was created by man2html, using the manual pages.
Time: 21:51:59 GMT, February 02, 2023