TWM(1X11) COMMAND REFERENCE TWM(1X11) NAME twm - a window manager for X11 SYNOPSIS twm [-display display] This is a user-contributed client. DESCRIPTION The twm program is a window manager client application of the window server. The twm program was written to incorporate some of the desirable features of both the wm(1x11) and uwm(1x11) window managers. The twm window manager puts a title bar on windows 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 iconifies the window. The right most title bar button with the right angles is the resize button. The resize function is identical to the window resize function of the wm window manager. The other title bar button represents a keyboard; a button click here causes the input focus to stay directed to this window until the f.unfocus function is executed or another window is selected to get input focus. By default, the input focus follows the mouse or other pointing device. The title bar also becomes highlighted on the window that currently 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 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 uppercase and lowercase letters. Functions must be entered in lowercase. A pound sign (#) character in the startup file indicates a comment which is terminated by the newline character. Printed 3/22/89 1
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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. The twm window manager 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. 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". BorderColor string 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 default is "black". BorderTileForeground string This variable sets the foreground color of the "grey" bitmap used in non-highlighted borders. It can only be Printed 3/22/89 2
TWM(1X11) COMMAND REFERENCE TWM(1X11) specified inside of a Color or Monochrome list. The default is "black". BorderTileBackground string 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 default is "white". BorderWidth pixels This variable specifies the width in pixels of of the border surrounding all windows. The default is 2. 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. 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. Printed 3/22/89 3
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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. 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 This variable sets the background color of icons. It can only be specified inside of a Color or Monochrome list. The default is "white". IconBorderColor string This variable sets the color of the border around icons. It can only be specified inside of a Color or Monochrome list. The default is "black". IconDirectory string This variable names the directory in which to search for icon bitmap files. This variable is described under the VARIABLES SECTION heading. 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 This variable sets the foreground color of icons. It can only be specified inside of a Color or Monochrome Printed 3/22/89 4
TWM(1X11) COMMAND REFERENCE TWM(1X11) list. The default is "black". IconifyByUnmapping This variable causes twm to iconify windows by simply unmapping them. The icon window will not be made visible. This variable can be used in conjunction with the DontIconifyByUnmapping list. The default is to iconify by unmapping the window and mapping a separate icon window. IconManagerDontShow { list } This variable 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." IconManagerBackground string This variable sets the background color of the icon manager window. It can only be specified inside of a Color or Monochrome list. The default is "white". IconManagerForeground string This variable sets the foreground color of the icon manager window. It can only be specified inside of a Color or Monochrome list. The default is "black". IconManagerGeometry string 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 vrey important because the height of the window will be changing as windows are created and destroyed. 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". Printed 3/22/89 5
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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. 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. 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. 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. Printed 3/22/89 6
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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. 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. 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. 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". 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. This variable doesn't really do much now that you can specify individual colors. Printed 3/22/89 7
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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. TitleBackground string This variable sets the background color for the title bars. It can only be specified inside of a Color or Monochrome list. The default is "white". TitleForeground string This variable sets the foreground color for the title bars. It can only be specified inside of a Color or Monochrome list. The default is "black". 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. 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 is 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. 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. Printed 3/22/89 8
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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, and iconmgr. The function field specifies the window manager function to perform. It is important to note that the iconmgr context is only used when a pointer button is pressed in an icon manager window and the window is an icon. By default, a button press in an icon manager window while the window is not iconic, will turn the window into an icon. 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 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. 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 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. FUNCTIONS ! string This function causes string to be sent to /bin/sh for execution. Printed 3/22/89 9
TWM(1X11) COMMAND REFERENCE TWM(1X11) ^ string This function causes string followed by a new line character to be placed in the window server's cut buffer. f.beep This function causes the bell of the workstation to be sounded. 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.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 a dot and the next window that receives a button press will be the window that is deiconified. f.destroy This function allows you to destroy a window client. If executed from a menu, the cursor is changed to a skull and crossbones and the next window to receive a button press will be destroyed. 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 implements the same function as the keyboard focus button in the title bar. If executed from a menu, the cursor is changed to a dot 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 a double arrow and the Printed 3/22/89 10
TWM(1X11) COMMAND REFERENCE TWM(1X11) next window that receives a button press will be the window that is moved. 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 a dot 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.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 a dot and the next window to receive a button press will be iconified or de-iconified depending on the current state of the window. f.lower This function lowers the window to the bottom of the Printed 3/22/89 11
TWM(1X11) COMMAND REFERENCE TWM(1X11) stacking order. If executed from a menu, the cursor is changed to a dot 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.move This function allows you to move a window. If executed from a menu, the cursor is changed to a double arrow 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.nop This function does nothing. f.quit This 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.raise This function raises the window to the top of the stacking order. If executed from a menu, the cursor is changed to a dot 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 a dot 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.resize Printed 3/22/89 12
TWM(1X11) COMMAND REFERENCE TWM(1X11) This function implements the window resize function of the resize button in the title bar. If executed from a menu, the cursor is changed to a double arrow and the next window that receives a button press will be the window that is resized. f.showiconmgr This function causes the icon manager window to become mapped (visible). 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.title This 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.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.unfocus This function assigns input focus to the root window. 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.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 a dot and the next window that receives a button press will be the window that is refreshed. f.zoom This 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 a dot and the next window that receives a button press will be the window that is zoomed/unzoomed. Printed 3/22/89 13
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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" { string function . . string 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 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 functions described in the previous section. There is a special menu called TwmWindows. When this menu is pulled down, a list of all window names is displayed in the menu. 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. ICON MANAGER The 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. If however, a button function was specified with a context of iconmgr, that function will be executed instead. 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 button one Printed 3/22/89 14
TWM(1X11) COMMAND REFERENCE TWM(1X11) is pressed, the client window is created with the window position equal to the current pointer position. If pointer button two is pressed, twm allows the window to be resized. The resizing operation takes place until button two is released. 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 BorderWidth 2 TitleFont "8x13" MenuFont "8x13" IconFont "8x13" Color { BorderColor "red" 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" Printed 3/22/89 15
TWM(1X11) COMMAND REFERENCE TWM(1X11) Button1 = : title : f.raise Button2 = : title : f.move Button3 = : title : t.lower ForceIcons IconDirectory "~/icons" Icons { "xterm" "xterm.icon" # obtained from IconDirectory "xfd" "xfd_icon" # obtained from /usr/include/X11/bitmaps } UnknownIcon "default.icon" NoTitle { "xclock" # don't need a title bar on this ... "xckmail" # or this } 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 &" "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" } Printed 3/22/89 16
TWM(1X11) COMMAND REFERENCE TWM(1X11) 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 } FILES $HOME/.twmrc CAVEATS 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. SEE ALSO X(1x11), Xserver(1x11) AUTHOR Thomas LaStrange, Hewlett Packard Printed 3/22/89 17
%%index%% na:288,82; sy:370,203; de:573,2269;3202,3292;6854,3850;11064,3783;15207,4839;20406,4318;25084,3412;28856,4041;33257,3817;37434,3038;40832,2624;43816,2880;47056,3410;50826,4092;55278,580; ex:55858,1580;57798,1950;60108,588; fi:60696,95; ca:60791,503; se:61294,256; %%index%%000000000297