TWM info
kelsoo edited this page 4 years ago

twm-info

each indipendedent section separated with a row of letters A-Z

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

https://www.oreilly.com/library/view/x-window-system/9780937175149/Chapter03.html#ch3-04

Using the twm Window Manager

This chapter describes twm, the standard window manager distributed with X. Additional information on customizing the operation of twm is provided in Chapter 10.

In This Chapter:

Starting the Window Manager

Titlebars

The Twm Menu

Displaying Windows as Icons

Resizing Windows

Moving Windows and Icons

Shuffling the Window Stack: Raise and Lower

Raising Windows (bringing in front of others)

Lowering Windows (sending behind others)

Changing Keyboard Focus

Removing a Window: Delete and Kill

Restarting the Window Manager

Exiting the Window Manager

Button Control of Window Manager Functions

Using twm to Place Other Clients

Customizing twm

Some of My Keystrokes are Missing

3 Using the twm Window Manager

The twm window manager is primarily a window manipulation tool. It allows you to:

• Size and position client windows on the screen interactively.

• Move windows around the screen.

• Change the size of windows.

• Lower windows (send them to the back of others).

• Raise windows (bring them to the front of others).

• Convert windows to icons and icons to windows.

• Remove windows.

The twm window manipulation functions can be invoked in four ways:

• Using the titlebar.

• Using the Twm menu.

• By combinations of keyboard keys and pointer buttons.

• Automatically, when a client is started (to allow you to size and place the client window on the screen).

This chapter discusses each of these subjects in detail, but first we’ll take a look at starting twm. Starting the Window Manager

As described in Chapter 2, Getting Started, you start twm from the command line by typing: % twm &

in an xterm window. If xdm (the display manager) is starting X on your system, the twm window manager is probably started automatically when you log on. It may also be started automatically from an .xinitrc file. (See Appendix A, System Management, for details.) When twm is started, you will see it add a titlebar to each window. Titlebars are useful; we’ll say more about them in the next section.

Note also that you can run xterm or other X clients without running a window manager. twm allows you to size and place client windows on the screen, but you can also use command line options to do this. However, there is no easy way to change the size or location of windows on the screen without a window manager. Title bars

When twm starts up, it places a titlebar on every window on the screen. This titlebar contains the name of the window (“xterm,” for example), two buttons, and a region that is highlighted when the input focus is in the associated window.

The titlebar provides convenient access to the most commonly used window manager functions: iconify, resize, raise, and lower. Iconify allows you to shrink an unneeded window so that it’s out of your way. Resize allows you to change the size of a window. Raise and lower change the window’s position with respect to other windows that may be partially or completely covering it. All this without having to bring up a menu or type modifier keys! (See Figure 3-1 for a closer look at the titlebar.)

From the titlebar, you can:

• Iconify the window, by clicking the first pointer button (usually the leftmost) in the left-hand command button in the titlebar (it’s marked with an X).

• Resize the window, by pressing the first pointer button in the right-hand command button in the titlebar (which contains a group of nested squares). Then, while holding down the first pointer button, move the pointer across the border you want to move. Drag the pointer to move the border the desired amount and then release the pointer button.

• Raise the window to the top of the stack, by clicking the first pointer button on the titlebar.

• Lower the window to the bottom of the stack, by clicking the middle pointer button on the titlebar.

• Move the window, by pressing and holding down the left pointer button on the titlebar, dragging the window to a new location, and releasing the pointer button.

images

Figure 3-1. Anatomy of a twm titlebar

These functions can also be invoked from a menu and will be discussed more thoroughly in the next section. The Twm Menu

twm’s Twm menu gives you access to many of the most frequently used window manipulation functions. In the standard version of twm shipped by MIT, you bring up this menu by moving the pointer to the root window and holding down the left pointer button. The Twm menu and the menu pointer appear as shown in Figure 3-2.

The following pages explain the functions of the Twm menu. Remember that all of the window manager functions are customizable. Items can be added to or deleted from this menu, and new menus can be defined by modifying the .twmrc window manager startup file, as described in Chapter 10, Customizing the twm Window Manager. The current chapter describes the window manager as it is shipped with the standard release of the X Window System from the MIT X Consortium.

To bring up the Twm menu, move the pointer to the root window and hold down the left button on the pointer. To select a menu item, continue to hold down the left button and move the pointer to the desired menu item. A horizontal band, or highlighting bar, follows the pointer. When you’ve highlighted the desired menu item, release the button. The selected function will be executed.

images

Figure 3-2. Twm menu

Some of the functions on the menus can be invoked simply by pressing a combination of pointer buttons and keyboard keys. We discuss these “keyboard shortcuts” as appropriate when discussing each menu function, and summarize them in Table 3-1 later in this Chapter. Some of these shortcuts make use of the “Meta” modifier key. See Chapter 11, Setup Clients, for a discussion of how to determine which key on your keyboard serves as the Meta key. (For the Sun-3 keyboard, for example, Meta is either of the keys labeled “Left” or “Right”) Displaying Windows as Icons

If you want to make more space available on your screen, you can convert a window into an icon. An icon is a small symbol that represents the application window. You can also convert the icon back into a window, as shown in Figure 3-3 and Figure 3-4.

To convert a window to an icon:

  1. Bring up the Twm menu.

  2. Select Iconify with the menu pointer. The pointer changes to the target pointer.

  3. Move the target pointer to the desired window.

  4. Click the left button. The window is converted to an icon.

images

Figure 3-3. The login window is about to become an icon

images

Figure 3-4. The login window is about to be deiconified

To display an icon as its original window, simply click the left button on the icon. twm has a couple of advanced techniques for managing icons. One, the Icon Manager, will be discussed in the next section. The other, the Icon Region, is documented in the twm man page. The Icon Manager

The Show Iconmgr and Hide Iconmgr menu items control a twm feature called the Icon Manager. The Icon Manager is a small, menu-like window that contains one entry for each window on the screen. An iconified window will have a small X before it; a window can be iconified and deiconified just by clicking on its entry in the Icon Manager. The Icon Manager also highlights the window with the current input focus.

By using the Icon Manager in conjunction with the variable IconifyByUnmapping, you can keep all your icons conveniently in one place, and avoid searching for icons that have been hidden under other windows. See Chapter 10, Customizing the twm Window Manager, for information on setting variables in twm. Resizing Windows

The Resize menu item resizes an existing window. See Figure 3-5. To resize a window:

  1. Bring up the Twm menu.

  2. Select Resize with the menu pointer. The pointer changes to the cross pointer.

  3. Move the cross pointer to the window you want to resize. Place it near the border you want to move. The opposite border remains in its current position.

  4. Hold down any button.

  5. Move the pointer across the border you want to change, then move the window’s border to obtain the desired window size. As you resize the window, a digital readout appears opposite the pointer showing the window size in pixels. (For the xterm client, size is in characters and lines.) Release the button.

Resizing an xterm window will not change the dimensions of the text currently in the window. (If you make the window smaller, for instance, some of the text may be obscured.) However, if the operating system supports terminal resizing capabilities (for example, the SIGWINCH signal in systems derived from BSD 4.3), xterm will use these facilities to notify programs running in the window whenever it is resized. As you continue to work, perhaps starting an editing session, the program will use the entire window. If you resize during an editing session, the text editing program may not know about the new size, and may operate incorrectly. Simply quitting out of the editor and starting another session should solve this problem.

If your resized xterm window does not seem to know its new size, you may be working with an operating system that does not support terminal resizing capabilities. Refer to the discussion of the resize client in Chapter 4, The xterm Terminal Emulator, (and to the resize reference page in Part Three of this guide) for alternative solutions.

images

Figure 3-5. Resizing a window Moving Windows and Icons

The Move menu item moves a window or an icon to a new location. When you use this function, an outline, not the entire window or icon, tracks the pointer movement to the new location. See Figure 3-6. To move a window:

  1. Bring up the Twm menu.

  2. Select Move with the menu pointer. The pointer changes to the cross pointer.

  3. Move the cross pointer to the desired window or icon. Hold down any button. Move the pointer and a window outline appears. This outline tracks the pointer movement.

  4. Move the cross pointer with the window outline to the desired location on your screen.

  5. Release the button. The window will move to the new location.

images

Figure 3-6. Moving windows or icons

You can also move a window or icon simply by moving the pointer to the window or icon you want to move, then pressing the right pointer button while holding down the Meta key. The pointer at first changes to a small image of an icon. You can now let go of the Meta key. Then, as you drag the pointer while holding down the button, the pointer changes to a cross, while the window or icon changes to outline form. Drag the outline to the new location, and let go of the right button. The window will be redrawn in the new location. Shuffling the Window Stack: Raise and Lower

Under the X Window System, windows can overlap each other. When windows overlap, one or more windows may be fully or partially hidden behind other windows (see Figure 3-7). You can think of these windows as being stacked on top of each other much the way papers are stacked on a desk. twm can control the stacking order of the windows by lowering a particular window to the bottom of the stack or raising it to the top.

images

Figure 3-7. One xterm window overlapping another Raising Windows (bringing in front of others)

The Raise menu item places a window at the top of a window stack. See Figure 3-8. To bring a window to the front:

  1. Bring up the Twm menu.

  2. Select Raise with the menu pointer. The pointer changes to the target pointer.

  3. Move the target pointer to the desired window.

  4. Click any button. The window is raised to the top of the stack.

images

Figure 3-8. Raising a window Lowering Windows (sending behind others)

The Lower menu item places a window at the bottom of a window stack. To place a window at the bottom:

  1. Bring up the Twm menu.

  2. Select Lower with the menu pointer. The pointer changes to the target pointer.

  3. Move the target pointer to the appropriate window.

  4. Click any button. The desired window is placed behind all windows except the root window.

To raise or lower a window without using the menu:

• To raise a window, move the pointer so that the cursor is within the titlebar of the window you want to raise, then click the left pointer button. The window is raised.

• To lower a window, move the pointer so that the cursor is within the titlebar of the window you want to lower, then click the middle pointer button. The window is lowered. Changing Keyboard Focus

Normally, keyboard input goes to whichever window the pointer is currently in. The Focus option causes keyboard input to go only to a selected window (the focus window) regardless of the position of the pointer.

Focusing can be useful if you are working in one window for an extended period of time, and want to move the pointer out of the way. It also prevents the annoying situation in which you inadvertently knock the pointer out of the window while typing. (This can be very important for touch typists who look infrequently at the screen while typing!)

To choose a focus window:

  1. Bring up the Twm menu.

  2. Select Focus with the menu pointer. The pointer changes to the target pointer.

  3. Move the target pointer to the window you want to choose as the focus window.

  4. Click any button to choose the window.

The titlebar of the focus window will remain highlighted, no matter where you move the pointer.

In order to take the focus away from the selected window (and reactivate “pointer focus”), select Unfocus. The keyboard focus will once again follow the pointer into any window. Removing a Window: Delete and Kill

The Delete and Kill menu items provide two different ways of terminating a client window. Most windows can be removed in ways that do not harm relevant processes. Delete is one of these ways. It simply requests that the client close itself down gracefully.

Like other methods of “killing” a program (such as the xkill client), the Kill menu item can adversely affect underlying processes. Kill is intended to be used primarily after more conventional methods of removing a window have failed.

To remove a window:

  1. Bring up the Twm menu.

  2. Select Delete with the menu pointer. The pointer changes to the skull and crossbones pointer.

  3. Move the pointer into the window you want to terminate.

  4. Click any pointer button.

The window should go away. It may, instead, beep and remain on your screen. You have a stubborn window, which can be killed in the following way:

  1. Bring up the Twm menu.

  2. Select Kill with the menu pointer. The pointer changes to the skull and crossbones pointer.

  3. Move the pointer into the window you want to terminate.

  4. Click any pointer button.

The window will go away.

Refer to the section on xkill in Chapter 7, Other Clients, for a more complete discussion of the hazards of killing a client and a summary of alternatives. Restarting the Window Manager

The Restart menu item restarts the window manager. This may occasionally become necessary if the window manager functions improperly. To stop and restart the window manager:

  1. Bring up the Twm menu.

  2. Select Restart with the menu pointer.

You may also want to restart the window manager if you edit your .twmrc configuration file to change the functionality of twm. See Chapter 10, Customizing the twm Window Manager, for more information.

Note that when the window manager is stopped, all icons revert to windows. This happens because the window manager is what allows windows to be iconified. When the window manager is restarted, you can iconify the windows again. Exiting the Window Manager

The Exit menu item stops the window manager. You may want to stop twm in order to start another window manager. To stop twm:

  1. Bring up the Twm menu.

  2. Select Exit with the menu pointer.

The window manager is stopped. All icons revert to windows. Button Control of Window Manager Functions

Table 3-1 summarizes the keyboard and titlebar shortcuts for window management functions. The first column lists the desired function; the second, the required location for the pointer; and the third, the button-key combination. In this column, “click” means to press and immediately release the specified pointer button; “down” means to press and hold the pointer button, and “drag” means to move the pointer while holding down the pointer button. In all cases, you can let go of the keyboard key as soon as you have pressed the appropriate pointer button.

Note that these key “bindings” can be changed in your .twmrc file, as described in Chapter 10. The combinations described in the table work for the system.twmrc file.

Table 3-1. Keyboard Shortcuts for Window Manager Functions Function Pointer Location Keyboard Shortcut move title bar First pointer button down and drag move window or icon Meta key, right pointer button down and drag resize “nested squares” titlebutton Any pointer button down, cross desired border, and drag raise title bar First pointer button click raise window or icon Meta key, third pointer button click lower title bar Second (middle) pointer button click lower window or icon Meta key, first pointer button click iconify “X” titlebutton Any pointer button click iconify window Meta key, second pointer button click deiconify icon Second pointer button click Twm menu root First pointer button down Customizing twm

The twm window manager is a powerful tool that can perform many more functions than are described in this chapter. You can customize twm using the .twmrc file in your home directory. Customizing this file, you can:

• Define your own twm menus.

• Bind functions to keyboard key/pointer button combinations.

• Issue command strings to the shell.

For details on customizing, and an example of a modified .twmrc file, see Chapter 10, Customizing the twm Manager. Some of My Keystrokes are Missing

If you are running Release 4, especially if you are running on a small or slow system, you may notice that the system can’t keep up with the movement of the pointer. You may move from one window to another and begin typing, only to find that your first few characters were entered into the original window, or dropped into intervening windows.

This annoying problem is caused by a subtle interaction between the operating system, the X server, and the window manager. It is unlikely to be fixed in the near future, but twm provides a workaround: setting the variable NoTitleFocus in your .twmrc file should keep the bug from popping up. See Chapter 10 for information on creating a .twmrc file and setting variables.

Get X Window System User's Guide for X11 R3 and R4 of the X Window System now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

https://www.oreilly.com/library/view/x-window-system/9780937175149/Chapter10.html

10 Customizing the twm Window Manager

This chapter describes the syntax of the .twmrc startup file that can be used to customize the operation of the twm window manager. It describes how to bind functions to keys, and how to define your own twm menus. An alternative .twmrc file is included.

In This Chapter:

Setting .twmrc Variables

Button/Key Bindings

Pointer Buttons

Keys

Context

Function Names

Action

Defining Menus

Submenus

Executing System Commands from a Menu

Color Menus

A Complete Revamp of twm

10 Customizing the twm Window Manager

Difficult as it may be to believe, every function of the window manager described in Chapter 2 and Chapter 3 of this guide can be modified by the user. The function itself will remain the same (for example, you will still resize a window by moving the pointer over the border you want to change, and stretching or shrinking the window to the size you want), but the keys and/or menu items used to invoke the function may be completely different. The flexibility of twm allows you to redesign the Twm menu by reordering, adding and removing items, and changing key/button combinations; and to create entirely new menus. The operation of the window manager, as distributed, is controlled by a text file called system.twmrc in the directory /usr/lib/X11/twm. This file has three parts:

• A variables section, which contains various settings, such as the font with which menus should be displayed, the volume of the keyboard bell, and so on.

• A key bindings section, which defines the keys, pointer buttons, and key and pointer button combinations that will be used to invoke each window manager function (including the display of menus).

• A menus section, which defines the contents of the menus.

As users gain experience with the window manager, each can create a file called .twmrc in his or her home directory. This file can simply extend system.twmrc, resetting a variable or two, perhaps changing a key binding or adding a menu item—or it can replace it completely, changing every aspect of the way the window manager operates.

Rather than abstractly explaining the syntax of these various sections in a .twmrc file, let’s plunge right in, by looking at the system.twmrc file from the MIT X11 distribution, as shown in Example 10-1. (Note that if you are using a commercial version of X, this file may be significantly different. However, in that case, you most likely have a user’s guide specific to your system—perhaps even a customized version of this one!)

Example 10-1. The system.twmrc file from the MIT distribution

$XConsortium: system.twmrc, v 1.7 89/12/01 11:23:47 jim Exp $
Default twm configuration file; needs to be kept small to conserve
string space in systems whose compilers don't handle medium-sized
strings.
Sites should tailor this file, providing any extra title buttons,
menus, etc., that may be appropriate for their environment. For
example, if most of the users were accustomed to uwm, the defaults
could be set up not to decorate any windows and to use meta-keys.

NoGrabServer DecorateTransients TitleFont "-adobe-helvetica-bold-r-normal---120------" ResizeFont "-adobe-helvetica-bold-r-normal---120------" MenuFont "-adobe-helvetica-bold-r-normal---120------" IconFont "-adobe-helvetica-bold-r-normal---100------" IconManagerFont "-adobe-helvetica-bold-r-normal---100---" #ClientBorderWidth

Color {

BorderColor "slategrey"
DefaultBackground "maroon"
DefaultForeground "gray85"
TitleBackground "maroon"
TitleForeground "gray85"
MenuBackground "maroon"
MenuForeground "gray85"
MenuTitleBackground "gray70"
MenuTitleForeground "maroon"
IconBackground "maroon"
IconForeground "gray85"
IconBorderColor "gray85"
IconManagerBackground "maroon"
IconManagerForeground "gray85"

}

Define some useful functions for motion-based actions.

MoveDelta 3 Function "move-or-lower" { f.move f.deltastop f.lower } Function "move-or-raise" { f.move f.deltastop f.raise } Function "move-or-iconify" { f.move f.deltastop f.iconify }

Set some useful bindings. Sort of uwm-ish, sort of simple-button-ish

Button1 = : root : f.menu "defops"

Button1 = m : window|icon : f.function "move-or-lower" Button2 = m : window|icon : f.iconify Button3 = m : window|icon : f.function "move-or-raise"

Button1 = : title : f.function "move-or-raise" Button2 = : title : f.raiselower

Button1 = : icon : f.function "move-or-iconify" Button2 = : icon : f.iconify

Button1 = : iconmgr : f.iconify Button2 = : iconmgr : f.iconify

And a menu with the usual things

menu "defops" { "Twm" f.title "Iconify" f.iconify "Resize" f.resize "Move" f.move "Raise" f.raise "Lower" f.lower "" f.nop "Focus" f.focus "Unfocus" f.unfocus "Show Iconmgr" f.showiconmgr "Hide Iconmgr" f.hideiconmgr "" f.nop "Kill" f.destroy "Delete" f.delete "" f.nop "Restart" f.restart "Exit" f.quit }

If you wish to change the operation of the window manager, you shouldn’t change the system.twmrc file. Instead, copy it to your home directory, under the name .twmrc, and make changes to that copy. Note that settings in system.twmrc and your own local .twmrc file are not cumulative; even if you only want to make a small change, you will need to copy the whole file. Setting .twmrc Variables

The first section of the file sets global variables. Some variables are Boolean—that is, their presence or absence “toggles” some attribute of the window manager—while others have the form: variable value

where value is a number, a text string, keyword, or list of any of these. Variable names and keywords are case insensitive.

An example of a Boolean variable is DecorateTransients, which, if present, causes all windows to have titlebars, even if they are only intended to appear for a short time.

An example of a text string variable is: MenuFont "-adobe-helvetica-bold-r-normal---120------*"

which names the font that should be used in all menus. Text string variables are case sensitive, and must always be surrounded by double quotes. (See Appendix E, Release 3 and 4 Standard Fonts, for lists and illustrations of fonts in the standard X11 distribution.)

An example of a numeric variable is: IconBorderWidth 5

which sets the width of an icon’s window border in pixels.

In the following example, TitleHighlight is a keyword: Pixmaps { TitleHighlight "gray1" }

An example of a list variable is: NoTitle { "oclock" "xclock" "xscreensaver" "zwgc" }

The available variables are described in detail on the twm reference page in Part Three of this guide, so we won’t go into detail on each of them here. Button/Key Bindings

The second section of the .twmrc file specifies which combination of keys, pointer buttons, and title buttons (and in which context) will be used to invoke each predefined twm function. Let’s see how this works, by looking at the first few lines of the function binding section of system.twmrc.

BUTTON/KEY = KEYS : CONTEXT : FUNCTION ACTION

Button1 = : root : f.menu "defops"

Button1 = m : window|icon : f.function "move-or-lower" Button2 = m : window|icon : f.iconify

The first line we’ve shown is just a comment line, which is not present in the original file. It labels each of the fields in the line below. The first field is separated from the others by an equals sign; subsequent fields are separated by colons. In system.twmrc, fields are separated by tabs for clarity, making the colons (falsely) appear to be delimiters only for the context field; they could instead follow each other without intervening whitespace.

Let’s talk about each of the fields in turn. Pointer Buttons

The first field defines which keys or pointer buttons are used to invoke the function.

twm can handle a pointer with up to five buttons, which would be named Button1, Button2, Button3, Button4, and Button5. To bind a key to a twm function, just use that key’s keysym—the name that represents the label on a key. For example, the keysym for the F1 key on a DECstation 3100 is “F1”. For more information about keysyms, see Chapter 11, Setup Clients. Keys

The second field lists modifier keys, if any, which must be held down while invoking the specified function, twm recognizes the Shift, Control and Meta keys. (See Chapter 11, Setup Clients, for more discussion.) These names must be entered in the .twmrc file in lower case, and can be abbreviated s, c, and m.

If two keys must be held down at once, the names should be separated by a vertical bar ( | ). For example, c|s would mean that the Control and Shift keys should be pressed simultaneously. It is not permissible to bind a function to three keys at once. If the field is left blank, no key needs to be pressed while invoking the function.

Control and Shift should be familiar to most users. But what is a “Meta” key? There isn’t a key by that name on many keyboards—instead, Meta is a user-definable Control key that can be mapped to an actual key on the physical keyboard using the xmodmap client as described in Chapter 11. Most implementations of X will include a mapped Meta key. Type xmodmap without any arguments to display the map. The system.twmrc specifies the Meta key in many keyboard bindings. On workstations without a special key corresponding to Meta, you will have to use xmodmap to find out or change the definition of Meta to something reasonable.

Meta could be mapped to the Control key, although this could potentially lead to conflicts with applications that want to use the Control key. In particular, certain functions of xedit will operate strangely or not at all if Meta is mapped to Control.

If you want to map the Meta key, it is best to choose a keyboard key that’s within easy reach and is not used frequently for other applications (perhaps an Alt or Funct key). Left- or right-handedness could also be a factor in choosing a Meta key.

Some X developers warn against binding functions to the Shift key alone, since they say certain applications use it as a Control key. If you use it in twm, it will perform both functions simultaneously, which is likely to be confusing. For the same reason, you should not bind functions to buttons without modifier keys in the context of a window, as an application may want to use the pointer buttons for its own purposes. Context

The third field defines the context—the location the pointer must be in before the function can be invoked. This field may be blank, or may contain one or more of: window, title, icon, root, frame, iconmgr, their first letters (icon is i, iconmgr is m), or all. Multiple context specifications should be separated by vertical bars.

If root is specified, it means that the pointer must be in the root (background) window, and not in any other window or icon. If the context is window, icon, title, frame, or iconmgr, the pointer must be in the specified place(s) for the function to be invoked.

The context field makes perfect sense if you consider the sample function binding. Button2 = m : window|icon : f.iconify

f.iconify turns a window into an icon, or an icon into a window. The pointer must be in a window or an icon for the function to be used. Function Names

The first field in a key binding contains the name of a function, followed by an equals sign.

twm has a number of predefined functions. Each of these functions has a name beginning with "f.". The meaning of most of these functions should be fairly obvious to you from the name, if not from your experience using the window manager. For example, f.resize is used to resize a window, f.move to move a window, or f.iconify to change a window to an icon.

Others are less obvious. For example, f.identify provides a summary of the name and geometry of the window it’s invoked on. Notice the function f.nop, which appears coupled with a set of empty quotes rather than a menu selection. This line in the .twmrc creates a blank line on the Twm menu, to isolate the KillWindow and Exit selections from the others. If you select the blank line, nothing happens. If you substituted f.beep for f.nop, the keyboard would beep when the blank line was selected.

Each of the functions is described in detail on the reference page for twm in Part Three of this guide. Action

The fifth field, labeled “Action,” is typically used only for the f.menu and f.function functions, which allow you to invoke user-defined menus and functions. The fifth field specifies the name of a menu or function, whose contents are defined in the third section of the .twmrc file. If the menu or function name contains quotes, special characters, parentheses, tabs or blanks, it must be enclosed in double quotes. For consistency, you may want to always quote menu and function names. For example: Button1 = : root : f.menu "defops" Button1 = m|s : w|t|i|f|m : f.menu "defops" Button3 = : root : f.menu "utilities"

Going back to our sample function binding: Button1 = : root : f.menu "defops"

you can now understand that the f.menu function is invoked (bringing up the menu named “defops”) by moving the pointer to the root window and pressing the left pointer button.

All of the other function definitions should be equally readable to you. Go back for a moment and review the bindings shown in the system.twmrc file in Example 10-1.

You’ll notice that it is possible to bind the same function to more than one set of keys, buttons, and/or contexts. For example, the f.iconify function can be invoked while on a window by pressing the Meta key together with the middle button on the pointer. But when the pointer is in the icon, you can invoke this function by pressing only the middle button on the pointer. The reason for this becomes obvious if you realize that when the pointer is on a window, the middle pointer button alone might have some other meaning to the application running in that window. In order to avoid conflict with other applications, twm uses the more complex key/button combination. But when the pointer is in an icon or in the root window there is no possibility of conflict, and it can take a more forgiving approach. Defining Menus

The third section of a .twmrc file contains menu definitions. These definitions have the format: menu "menu_name" { "item_name" action

        .
        .
        .

}

The menu name must exactly match a name specified with the f.menu function.

Each item on the menu is given a label (item_name), which will appear on the menu. This is followed by the action to be performed. The action may be one of twm’s functions, or if prefixed by a ! character, it can be a system command to be executed, as if in an xterm window. The Utilities menu shown in Example 10-2 demonstrates both types of action.

Example 10-2. The Utilities menu menu = "Utilities" { "Identify" f.identify "Source .twmrc" f.twmrc "" f.beep "Check Mail" !"/usr/bin/X11/xbiff -display $DISPLAY&" "Clock" !"/usr/bin/X11/oclock -display $DISPLAY &" "New Window" !"/usr/bin/X11/xterm -ls -display $DISPLAY &" "Phase of Moon" !"/usr/bin/X11/xphoon &" "" f.beep "news" !"/usr/bin/X11/xhost news.mit.edu;

                    /usr/bin/X11/xterm -title news.mit.edu
                    -e rlogin news.mit.edu &"

"mintaka" !"/usr/bin/X11/xhost mintaka.lcs.mit.edu;

                    /usr/bin/X11/xterm -title mintaka.lcs.mit.edu
                    -e rlogin mintaka.lcs.mit.edu &"

}

New Window is accomplished by running another instance of xterm. CheckMail, Clock, PhaseofMoon, news, and mintaka are also implemented by running a system function. The other functions are accomplished simply by invoking one of twm’s predefined functions.

The Preferences menu shown in Example 10-3 simply invokes xset with a number of different options:

Example 10-3. The Preferences menu menu "Preferences" { "Bell Loud" !"xset b 80&" "Bell Normal" !"xset b on&" "Bell Off" !"xset b off& "Click Loud" !"xset c 80&" "Click Soft" !"xset c on&" "Click Off" !"xset c off&" "Lock On" !"xset led on&" "Lock Off" !"xset led off& "Mouse Fast" !"xset m 4 2&" "Mouse Normal" !"xset m 2 5&" "Mouse Slow" !"xset m 1 1&" } Submenus

While the menu defined by the system.twmrc file is a drastic improvement over the cluttered menus provided by uwm in previous releases of X11, it is still far from complete. We’d like to modify it to add a couple of menus which contain commands that, while still worth putting in a menu, aren’t used as frequently as the commands in the Twm menu.

For the moment, let’s assume that we want to leave the variable definitions and function key bindings alone, but want to add two submenus to the Twm menu. For example, we might copy system.twmrc to a local .twmrc file, and modify the menus section to be like the one shown in Example 10-4.

Example 10-4. Window operations divided into three menus menu "defops" { "Twm" f.title "Iconify" f.iconify "Resize" f.resize "Move" f.move "Raise" f.raise "Lower" f.lower "" f.nop "..Utilities" f.menu "Utilities" "..Preferences" f.menu "Preferences" "" f.nop "Focus" f.focus "Unfocus" f.unfocus "Show Iconmgr" f.showiconmgr "Hide Iconmgr" f.hideiconmgr "" f.nop "Kill" f.destroy "Delete" f.delete "" f.nop "Restart" f.restart "Exit" f.quit }

menu "Utilities" { "Utilities" f.title "" f.beep "Identify" f.identify "Source .twmrc" f.twmrc "" f.beep "Mail Box" !"/usr/bin/X11/xbiff -display $DISPLAY&" "Clock" !"/usr/bin/X11/oclock -display $DISPLAY &" "New Window" !"/usr/bin/X11/xterm -ls -display $DISPLAY &" "Phase of Moon" !"/usr/bin/X11/xphoon &" "" f.beep "news" !"/usr/bin/X11/xhost news.mit.edu;

                /usr/bin/X11/xterm -title news.mit.edu
                -e rlogin news.mit.edu &"

"mintaka" !"/usr/bin/X11/xhost mintaka.lcs.mit.edu;

                /usr/bin/X11/xterm -title mintaka.lcs.mit.edu
                -e rlogin mintaka.lcs.mit.edu &"

}

menu "Preferences" { "Preferences" f.title "Bell Loud" !"xset b 80&" "Bell Normal" !"xset b on&" "Bell Off" !"xset b off&" "Click Loud" !"xset c 80&" "Click Soft" !"xset c on&" "Click Off" !"xset c off&" "Lock On" !"xset led on&" "Lock Off" !"xset led off&" "Mouse Fast" !"xset m 4 2&" "Mouse Normal" !"xset m 2 5&" "Mouse Slow" !"xset m 1 1&" }

To get from one menu to another, we simply define f.menu as the action for one item on the menu. No key, button, or context is defined, so we go right to the next menu when selecting that item. Executing System Commands from a Menu

We mentioned above that it is possible to specify a system command as a menu action simply by placing an exclamation point in front of the string to be executed.

It is easy to cook up a menu that contains a miscellany of useful commands, as shown in Example 10-5.

Example 10-5. A Useful Commands menu Button1 = : root : f.menu "Useful Commands"

         .
         .
         .

menu "Useful Commands" { Analog clock !"xclock -geometry 162x162-10+10&" Digital clock !"xclock -digital -geometry 162x37-10+174&" Edit File !"xterm -e vi" Calculator !"xcalc -geometry 126x230-180+10&" Mailbox !"xbiff -geometry 65x65-353+10&" Display keyboard mappings !"xmodmap&" }

As you can quickly see, you can run any window-based programs directly, but you need to run other programs using xterm’s -e option (discussed in Chapter 4, The xterm Terminal Emulator). You are limited only by your imagination in what commands you might want to put on a menu. Each command runs in its own window, but that isn’t necessarily the case, as we’ll see in a moment. Color Menus

So far, we’ve assumed that all menus are black and white. But you can also create color menus. You can even assign different colors to the menu title, the highlighting bar (the horizontal band that follows the pointer within the menu and shows which item is selected) and the individual selections on the menu.

Colors are added to menus when they’re defined, using optional arguments. In Example 10-6, we show a “colorized” version of the Preferences menu that we defined earlier.

Example 10-6. A menu with color definitions menu "Preferences" ("WhiteSmoke" : "HotPink" ) { "Preferences" ("DarkSlateGray" : "thistle") f.title "Bell Loud" ("DarkSlateGray" : "bisque1") !"xset b 80&" "Bell Normal" ("DarkSlateGray" : "bisque1") !"xset b on&" "Bell Off" ("DarkSlateGray" : "bisque1") !"xset b off&" "Click Loud" ("DarkSlateGray" : "azure1") !"xset c 80&" "Click Soft" ("DarkSlateGray" : "azure1") !"xset c on&" "Click Off" ("DarkSlateGray" : "azure1") !"xset c off&" "Lock On" !"xset led on&" "Lock Off" !"xset led off&" "Mouse Fast" ("DarkSlateGray" : "gold1") !"xset m 4 2&" "Mouse Normal" ("DarkSlateGray" : "gold1") !"xset m 2 5&" "Mouse Slow" ("DarkSlateGray" : "gold1") !"xset m 1 1&" }

In this example, WhiteSmoke and HotPink are the foreground and background (respectively) of a highlighted menu item. The colors defined for each menu item are the foreground and background colors (in that order) for that item when it is not highlighted. The default foreground and background colors for menu items are controlled by the variables MenuForeground and MenuBackground.

twm has eighteen variables controlling different aspects of its color: BorderColor The default color of a window’s border. BorderTileBackground The default background color of the gray pattern used in an unhighlighted window border. BorderTileForeground The default foreground color of the gray pattern used in an unhighlighted window border. DefaultBackground The background color to be used for sizing and information windows. DefaultForeground The foreground color to be used for sizing and information windows. IconBackground The background color of icons. IconForeground The foreground color of icons. IconBorderColor The default color of an icon’s border. IconManagerBackground The background color to use for icon manager entries. IconManagerForeground The foreground color to use for icon manager entries. IconManagerHighlight The border color used when highlighting the icon manager entry which has the focus. MenuBackground The background color used for menus. MenuForeground The foreground color used for menus. MenuShadowColor The color used for the shadow behind pull-down menus. MenuTitleBackground The background color of the highlighting bar. MenuTitleForeground The background color of the highlighting bar. TitleBackground The background color of the highlighting bar. TitleForeground The background color of the highlighting bar.

These variables are most commonly used as arguments to the Color and Monochrome variables, as seen in Example 10-1.

Colors can be specified either with color names or hex strings, as described in Chapter 8, Command Line Options. A Complete Revamp of twm

Using the various techniques described in this chapter, we’ve modified the system.twmrc file to create an interface we think is more helpful to the average user.

Our modified .twmrc file sets up three pull-right menus, each with a slightly different focus. The second menu offers some utilities, including oclock and xcalc, and some system commands, such as rlogin. The final menu is a Preferences menu, which sets different keyclick volumes, leds, and pointer speeds than the default.

You can test our .twmrc, shown in Example 10-7, or just use it as a touchstone to create your own.

Example 10-7. Modified .twmrc file

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

https://forum.salixos.org/viewtopic.php?t=7505 Wiki: "You might find that titlebars and menu entries in TWM are extremely large - twice the size that one might typically expect. This is a locale issue with TWM that occurs when a UTF-8 locale is used. Setting the locale to C fixes the issue. See [2]."

I use Terminus font: "-xos4-terminus-medium-r-normal---120---c-*-paratype-pt154"

Regards

888888888888888888888888888888888888888888888888888888888888 https://www.linuxquestions.org/questions/slackware-14/problems-with-twm-utf-8-a-4175435922/ I have to apologies to op. I checked my config several days after responding to this thread and I made two wrong statements.

  1. I did use something like this in my xinirc.twm in 13.37:

Code:

LC_CTYPE=en_US /usr/bin/twm

According to GNU Lib C documentation: Quote: LC_CTYPE - This category applies to classification and conversion of characters, and to multibyte and wide characters And it worked, so it seems there was a bug in twm character/string handling. Btw, it seems the bug has been fixed because it works nicely without that in 14.0.

  1. There is a section on fonts in twmrc:

Code:

Fonts

TitleFont "--dejavu sans-bold----12-------" MenuFont "--dejavu sans-bold----12-------" IconFont "--dejavu sans-bold----12-------" IconManagerFont "--dejavu sans-bold----12-------" ResizeFont "--dejavu sans-bold----12-------*"

8888888888888888888888888888888888888888888888888888888888888

adding: LC_CTYPE=en_US /bin/twm to: /etc/X11/xinit/xinitrc.twm

got it starting with startx for me

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

Table of Contents

Name twm - Tab Window Manager for the X Window System Syntax twm [ -display dpy ] [ -s ] [ -f initfile ] [ -v ] Description Twm is a window manager for the X Window System. It provides titlebars, shaped windows, several forms of icon management, user-defined macro functions, click-to-type and pointer-driven keyboard focus, and user-specified key and pointer button bindings.

This program is usually started by the user's session manager or startup script. When used from xdm(1) or xinit(1) without a session manager, twm is frequently executed in the foreground as the last client. When run this way, exiting twm causes the session to be terminated (i.e., logged out).

By default, application windows are surrounded by a frame'' with a titlebar at the top and a special border around the window. The titlebar contains the window's name, a rectangle that is lit when the window is receiving keyboard input, and function boxes known astitlebuttons'' at the left and right edges of the titlebar.

Pressing pointer Button1 (usually the left-most button unless it has been changed with xmodmap) on a titlebutton will invoke the function associated with the button. In the default interface, windows are iconified by clicking (pressing and then immediately releasing) the left titlebutton (which looks like a Dot). Conversely, windows are deiconified by clicking in the associated icon or entry in the icon manager (see description of the variable ShowIconManager and of the function f.showiconmgr).

Windows are resized by pressing the right titlebutton (which resembles a group of nested squares), dragging the pointer over edge that is to be moved, and releasing the pointer when the outline of the window is the desired size. Similarly, windows are moved by pressing in the title or highlight region, dragging a window outline to the new location, and then releasing when the outline is in the desired position. Just clicking in the title or highlight region raises the window without moving it.

When new windows are created, twm will honor any size and location information requested by the user (usually through -geometry command line argument or resources for the individual applications). Otherwise, an outline of the window's default size, its titlebar, and lines dividing the window into a 3x3 grid that track the pointer are displayed. Clicking pointer Button1 will position the window at the current position and give it the default size. Pressing pointer Button2 (usually the middle pointer button) and dragging the outline will give the window its current position but allow the sides to be resized as described above. Clicking pointer Button3 (usually the right pointer button) will give the window its current position but attempt to make it long enough to touch the bottom the screen. Options Twm accepts the following command line options:

-display dpy

This option specifies the X server to use. 

-s

This option indicates that only the default screen (as specified by -display or by the DISPLAY environment variable) should be managed. By default, twm will attempt to manage all screens on the display. 

-f filename

This option specifies the name of the startup file to use. By default, twm will look in the user's home directory for files named .twmrc.num (where num is a screen number) or .twmrc. 

-v

This option indicates that twm should print error messages whenever an unexpected X Error event is received. This can be useful when debugging applications but can be distracting in regular use. 

Customization

Much of twm's appearance and behavior can be controlled by providing a startup file in one of the following locations (searched in order for each screen being managed when twm begins):

$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. This is intended for displays with multiple screens of differing visual types. 

$HOME/.twmrc

This is the usual name for an individual user's startup file. 

/tmp/Xorg-KEM/lib/X11/twm/system.twmrc

If neither of the preceding files are found, twm will look in this file for a default configuration. This is often tailored by the site administrator to provide convenient menus or familiar bindings for novice users. 

If no startup files are found, twm will use the built-in defaults described above. The only resource used by twm is bitmapFilePath for a colon-separated list of directories to search when looking for bitmap files (for more information, see the Athena Widgets manual and xrdb(1) ).

Twm startup files are logically broken up into three types of specifications: Variables, Bindings, Menus. The Variables section must come first and is used to describe the fonts, colors, cursors, border widths, icon and window placement, highlighting, autoraising, layout of titles, warping, use of the icon manager. The Bindings section usually comes second and is used to specify the functions that should be to be invoked when keyboard and pointer buttons are pressed in windows, icons, titles, and frames. The Menus section gives any user-defined menus (containing functions to be invoked or commands to be executed).

Variable names and keywords are case-insensitive. Strings must be surrounded by double quote characters (e.g. "blue") and are case-sensitive. A pound sign (#) outside of a string causes the remainder of the line in which the character appears to be treated as a comment. Variables

Many of the aspects of twm's user interface are controlled by variables that may be set in the user's startup file. Some of the options are enabled or disabled simply by the presence of a particular keyword. Other options require keywords, numbers, strings, or lists of all of these.

Lists are surrounded by braces and are usually separated by whitespace or a newline. For example:

AutoRaise { "emacs" "XTerm" "Xmh" }

or

AutoRaise {

"emacs"
"XTerm"
"Xmh"

}

When a variable containing a list of strings representing windows is searched (e.g. to determine whether or not to enable autoraise as shown above), a string must be an exact, case-sensitive match to the window's name (given by the WM_NAME window property), resource name or class name (both given by the WM_CLASS window property). The preceding example would enable autoraise on windows named emacs'' as well as any xterm (since they are of classXTerm'') or xmh windows (which are of class ``Xmh'').

String arguments that are interpreted as filenames (see the Pixmaps, Cursors, and IconDirectory below) will prepend the user's directory (specified by the HOME environment variable) if the first character is a tilde (~). If, instead, the first character is a colon (:), the name is assumed to refer to one of the internal bitmaps that are used to create the default titlebars symbols: :xlogo or :delete (both refer to the X logo), :dot or :iconify (both refer to the dot), :resize (the nested squares used by the resize button), :menu (a page with lines), and :question (the question mark used for non-existent bitmap files).

The following variables may be specified at the top of a twm startup file. Lists of Window name prefix strings are indicated by win-list. Optional arguments are shown in square brackets:

AutoRaise { win-list }

This variable specifies a list of windows that should automatically be raised whenever the pointer enters the window. This action can be interactively enabled or disabled on individual windows using the function f.autoraise. 

AutoRelativeResize

This variable indicates that dragging out a window size (either when initially sizing the window with pointer Button2 or when resizing it) should not wait until the pointer has crossed the window edges. Instead, moving the pointer automatically causes the nearest edge or edges to move by the same amount. This allows the resizing of windows that extend off the edge of the screen. If the pointer is in the center of the window, or if the resize is begun by pressing a titlebutton, twm will still wait for the pointer to cross a window edge (to prevent accidents). This option is particularly useful for people who like the press-drag-release method of sweeping out window sizes. 

BorderColor string [{ wincolorlist }]

This variable specifies the default color of the border to be placed around all non-iconified windows, and may only be given within a Color, Grayscale or Monochrome list. The optional wincolorlist specifies a list of window and color name pairs for specifying particular border colors for different types of windows. For example:


BorderColor "gray50"
{
    "XTerm"    "red"
    "xmh"    "green"
}

The default is "black". 

BorderTileBackground string [{ wincolorlist }]

This variable specifies the default background color in the gray pattern used in unhighlighted borders (only if NoHighlight hasn't been set), and may only be given within a Color, Grayscale or Monochrome list. The optional wincolorlist allows per-window colors to be specified. The default is "white". 

BorderTileForeground string [{ wincolorlist }]

This variable specifies the default foreground color in the gray pattern used in unhighlighted borders (only if NoHighlight hasn't been set), and may only be given within a Color, Grayscale or Monochrome list. The optional wincolorlist allows per-window colors to be specified. The default is "black". 

BorderWidth pixels

This variable specifies the width in pixels of the border surrounding all client window frames if ClientBorderWidth has not been specified. This value is also used to set the border size of windows created by twm (such as the icon manager). The default is 2. 

ButtonIndent pixels

This variable specifies the amount by which titlebuttons should be indented on all sides. Positive values cause the buttons to be smaller than the window text and highlight area so that they stand out. Setting this and the TitleButtonBorderWidth variables to 0 makes titlebuttons be as tall and wide as possible. The default is 1. 

ClientBorderWidth

This variable indicates that border width of a window's frame should be set to the initial border width of the window, rather than to the value of BorderWidth. 

Color { colors-list }

This variable specifies a list of color assignments to be made if the default display is capable of displaying more than simple black and white. The colors-list is made up of the following color variables and their values: DefaultBackground, DefaultForeground, MenuBackground, MenuForeground, MenuTitleBackground, MenuTitleForeground, MenuShadowColor, MenuBorderColor, PointerForeground, and PointerBackground. The following color variables may also be given a list of window and color name pairs to allow per-window colors to be specified (see BorderColor for details): BorderColor, IconManagerHighlight, BorderTitleBackground, BorderTitleForeground, TitleBackground, TitleForeground, IconBackground, IconForeground, IconBorderColor, IconManagerBackground, and IconManagerForeground. For example:


Color
{
    MenuBackground        "gray50"
    MenuForeground        "blue"
    BorderColor            "red" { "XTerm" "yellow" }
    TitleForeground        "yellow"
    TitleBackground        "blue"
}

All of these color variables may also be specified for the Monochrome variable, allowing the same initialization file to be used on both color and monochrome displays. 

ConstrainedMoveTime milliseconds

This variable specifies the length of time between button clicks needed to begin a constrained move operation. Double clicking within this amount of time when invoking f.move will cause the window to be moved only in a horizontal or vertical direction. Setting this value to 0 will disable constrained moves. The default is 400 milliseconds. 

Cursors { cursor-list }

This variable specifies the glyphs that twm should use for various pointer cursors. Each cursor may be defined either from the cursor font or from two bitmap files. Shapes from the cursor font may be specified directly as:


    cursorname    "string"

where cursorname is one of the cursor names listed below, and string is the name of a glyph as found in the file /tmp/Xorg-KEM/include/X11/cursorfont.h (without the ``XC_'' prefix). If the cursor is to be defined from bitmap files, the following syntax is used instead:


    cursorname    "image"    "mask"

The image and mask strings specify the names of files containing the glyph image and mask in bitmap(1) form. The bitmap files are located in the same manner as icon bitmap files. The following example shows the default cursor definitions:


Cursors
{
    Frame        "top_left_arrow"
    Title        "top_left_arrow"
    Icon        "top_left_arrow"
    IconMgr    "top_left_arrow"
    Move        "fleur"
    Resize        "fleur"
    Menu        "sb_left_arrow"
    Button        "hand2"
    Wait        "watch"
    Select        "dot"
    Destroy    "pirate"
}

DecorateTransients

This variable indicates that transient windows (those containing a WM_TRANSIENT_FOR property) should have titlebars. By default, transients are not reparented. 

DefaultBackground string

This variable specifies the background color to be used for sizing and information windows. The default is "white". 

DefaultForeground string

This variable specifies the foreground color to be used for sizing and information windows. The default is "black". 

DontIconifyByUnmapping { win-list }

This variable specifies a list of windows that should not be iconified by simply unmapping the window (as would be the case if IconifyByUnmapping had been set). This is frequently used to force some windows to be treated as icons while other windows are handled by the icon manager. 

DontMoveOff

This variable indicates that windows should not be allowed to be moved off the screen. It can be overridden by the f.forcemove function. 

DontSqueezeTitle [{ win-list }]

This variable indicates that titlebars should not be squeezed to their minimum size as described under SqueezeTitle below. If the optional window list is supplied, only those windows will be prevented from being squeezed. 

ForceIcons

This variable indicates that icon pixmaps specified in the Icons variable should override any client-supplied pixmaps. 

FramePadding pixels

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

Grayscale { colors }

This variable specifies a list of color assignments that should be made if the screen has a GrayScale default visual. See the description of Colors. 

IconBackground string [{ win-list }]

This variable specifies the background color of icons, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. See the BorderColor variable for a complete description of the win-list. The default is "white". 

IconBorderColor string [{ win-list }]

This variable specifies the color of the border used for icon windows, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. See the BorderColor variable for a complete description of the win-list. The default is "black". 

IconBorderWidth pixels

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

IconDirectory string

This variable specifies the directory that should be searched if if a bitmap file cannot be found in any of the directories in the bitmapFilePath resource. 

IconFont string

This variable specifies the font to be used to display icon names within icons. The default is "variable". 

IconForeground string [{ win-list }]

This variable specifies the foreground color to be used when displaying icons, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. See the BorderColor variable for a complete description of the win-list. The default is "black". 

IconifyByUnmapping [{ win-list }]

This variable indicates that windows should be iconified by being unmapped without trying to map any icons. This assumes that the user will remap the window through the icon manager, the f.warpto function, or the TwmWindows menu. If the optional win-list is provided, only those windows will be iconified by simply unmapping. Windows that have both this and the IconManagerDontShow options set may not be accessible if no binding to the TwmWindows menu is set in the user's startup file. 

IconManagerBackground string [{ win-list }]

This variable specifies the background color to use for icon manager entries, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. See the BorderColor variable for a complete description of the win-list. The default is "white". 

IconManagerDontShow [{ win-list }]

This variable indicates that the icon manager should not display any windows. If the optional win-list is given, only those windows will not be displayed. This variable is used to prevent windows that are rarely iconified (such as xclock or xload) from taking up space in the icon manager. 

IconManagerFont string

This variable specifies the font to be used when displaying icon manager entries. The default is "variable". 

IconManagerForeground string [{ win-list }]

This variable specifies the foreground color to be used when displaying icon manager entries, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. See the BorderColor variable for a complete description of the win-list. The default is "black". 

IconManagerGeometry string [ columns ]

This variable specifies the geometry of the icon manager window. The string argument is standard geometry specification that indicates the initial full size of the icon manager. The icon manager window is then broken into columns pieces and scaled according to the number of entries in the icon manager. Extra entries are wrapped to form additional rows. The default number of columns is 1. 

IconManagerHighlight string [{ win-list }]

This variable specifies the border color to be used when highlighting the icon manager entry that currently has the focus, and can only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. See the BorderColor variable for a complete description of the win-list. The default is "black". 

IconManagers { iconmgr-list }

This variable specifies a list of icon managers to create. Each item in the iconmgr-list has the following format:


    "winname" ["iconname"]    "geometry" columns

where winname is the name of the windows that should be put into this icon manager, iconname is the name of that icon manager window's icon, geometry is a standard geometry specification, and columns is the number of columns in this icon manager as described in IconManagerGeometry. For example:


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

Clients whose name or class is ``XTerm'' will have an entry created in the ``XTerm'' icon manager. Clients whose name was ``myhost'' would be put into the ``myhost'' icon manager. 

IconManagerShow { win-list }

This variable specifies a list of windows that should appear in the icon manager. When used in conjunction with the IconManagerDontShow variable, only the windows in this list will be shown in the icon manager. 

IconRegion geomstring vgrav hgrav gridwidth gridheight

This variable specifies an area on the root window in which icons are placed if no specific icon location is provided by the client. The geomstring is a quoted string containing a standard geometry specification. If more than one IconRegion lines are given, icons will be put into the succeeding icon regions when the first is full. The vgrav argument should be either North or South and control and is used to control whether icons are first filled in from the top or bottom of the icon region. Similarly, the hgrav argument should be either East or West and is used to control whether icons should be filled in from left from the right. Icons are laid out within the region in a grid with cells gridwidth pixels wide and gridheight pixels high. 

Icons { win-list }

This variable specifies a list of window names and the bitmap filenames that should be used as their icons. For example:


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

Windows that match ``XTerm'' and would not be iconified by unmapping, and would try to use the icon bitmap in the file ``xterm.icon''. If ForceIcons is specified, this bitmap will be used even if the client has requested its own icon pixmap. 

InterpolateMenuColors

This variable indicates that menu entry colors should be interpolated between entry specified colors. In the example below:


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

the foreground colors for ``entry1'' and ``entry2'' will be interpolated between black and white, and the background colors between red and green. Similarly, the foreground for ``entry4'' will be half-way between white and red, and the background will be half-way between green and white. 

MakeTitle { win-list }

This variable specifies a list of windows on which a titlebar should be placed and is used to request titles on specific windows when NoTitle has been set. 

MaxWindowSize string

This variable specifies a geometry in which the width and height give the maximum size for a given window. This is typically used to restrict windows to the size of the screen. The default width is 32767 - screen width. The default height is 32767 - screen height. 

MenuBackground string

This variable specifies the background color used for menus, and can only be specified inside of a Color or Monochrome list. The default is "white". 

MenuBorderColor string

This variable specifies the color of the menu border and can only be specified inside of a Color, Grayscale or Monochrome list. The default is "black". 

MenuBorderWidth pixels

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

MenuFont string

This variable specifies the font to use when displaying menus. The default is "variable". 

MenuForeground string

This variable specifies the foreground color used for menus, and can only be specified inside of a Color, Grayscale or Monochrome list. The default is "black". 

MenuShadowColor string

This variable specifies the color of the shadow behind pull-down menus and can only be specified inside of a Color, Grayscale or Monochrome list. The default is "black". 

MenuTitleBackground string

This variable specifies the background color for f.title entries in menus, and can only be specified inside of a Color, Grayscale or Monochrome list. The default is "white". 

MenuTitleForeground string

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

Monochrome { colors }

This variable specifies a list of color assignments that should be made if the screen has a depth of 1. See the description of Colors. 

MoveDelta pixels

This variable specifies the number of pixels the pointer must move before the f.move function starts working. Also see the f.deltastop function. The default is zero pixels. 

NoBackingStore

This variable indicates that twm's menus should not request backing store to minimize repainting of menus. This is typically used with servers that can repaint faster than they can handle backing store. 

NoCaseSensitive

This variable indicates that case should be ignored when sorting icon names in an icon manager. This option is typically used with applications that capitalize the first letter of their icon name. 

NoDefaults

This variable indicates that twm should not supply the default titlebuttons and bindings. This option should only be used if the startup file contains a completely new set of bindings and definitions. 

NoGrabServer

This variable indicates that twm should not grab the server when popping up menus and moving opaque windows. 

NoHighlight [{ win-list }]

This variable indicates that borders should not be highlighted to track the location of the pointer. If the optional win-list is given, highlighting will only be disabled for those windows. When the border is highlighted, it will be drawn in the current BorderColor. When the border is not highlighted, it will be stippled with a gray pattern using the current BorderTileForeground and BorderTileBackground colors. 

NoIconManagers

This variable indicates that no icon manager should be created. 

NoMenuShadows

This variable indicates that menus should not have drop shadows drawn behind them. This is typically used with slower servers since it speeds up menu drawing at the expense of making the menu slightly harder to read. 

NoRaiseOnDeiconify

This variable indicates that windows that are deiconified should not be raised. 

NoRaiseOnMove

This variable indicates that windows should not be raised when moved. This is typically used to allow windows to slide underneath each other. 

NoRaiseOnResize

This variable indicates that windows should not be raised when resized. This is typically used to allow windows to be resized underneath each other. 

NoRaiseOnWarp

This variable indicates that windows should not be raised when the pointer is warped into them with the f.warpto function. If this option is set, warping to an occluded window may result in the pointer ending up in the occluding window instead the desired window (which causes unexpected behavior with f.warpring). 

NoSaveUnders

This variable indicates that menus should not request save-unders to minimize window repainting following menu selection. It is typically used with displays that can repaint faster than they can handle save-unders. 

NoStackMode [{ win-list }]

This variable indicates that client window requests to change stacking order should be ignored. If the optional win-list is given, only requests on those windows will be ignored. This is typically used to prevent applications from relentlessly popping themselves to the front of the window stack. 

NoTitle [{ win-list }]

This variable indicates that windows should not have titlebars. If the optional win-list is given, only those windows will not have titlebars. MakeTitle may be used with this option to force titlebars to be put on specific windows. 

NoTitleFocus

This variable indicates that twm should not set keyboard input focus to each window as it is entered. Normally, twm sets the focus so that focus and key events from the titlebar and icon managers are delivered to the application. If the pointer is moved quickly and twm is slow to respond, input can be directed to the old window instead of the new. This option is typically used to prevent this ``input lag'' and to work around bugs in older applications that have problems with focus events. 

NoTitleHighlight [{ win-list }]

This variable indicates that the highlight area of the titlebar, which is used to indicate the window that currently has the input focus, should not be displayed. If the optional win-list is given, only those windows will not have highlight areas. This and the SqueezeTitle options can be set to substantially reduce the amount of screen space required by titlebars. 

OpaqueMove

This variable indicates that the f.move function should actually move the window instead of just an outline so that the user can immediately see what the window will look like in the new position. This option is typically used on fast displays (particularly if NoGrabServer is set). 

Pixmaps { pixmaps }

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


Pixmaps
{
    TitleHighlight    "gray1"
}

The default for TitleHighlight is to use an even stipple pattern. 

Priority priority

This variable sets twm's priority. priority should be an unquoted, signed number (e.g. 999). This variable has an effect only if the server supports the SYNC extension. 

RandomPlacement

This variable indicates that windows with no specified geometry should be placed in a pseudo-random location instead of having the user drag out an outline. 

ResizeFont string

This variable specifies the font to be used for in the dimensions window when resizing windows. The default is "fixed". 

RestartPreviousState

This variable indicates that twm should attempt to use the WM_STATE property on client windows to tell which windows should be iconified and which should be left visible. This is typically used to try to regenerate the state that the screen was in before the previous window manager was shutdown. 

SaveColor { colors-list }

This variable indicates a list of color assignments to be stored as pixel values in the root window property _MIT_PRIORITY_COLORS. Clients may elect to preserve these values when installing their own colormap. Note that use of this mechanism is a way an for application to avoid the "technicolor" problem, whereby useful screen objects such as window borders and titlebars disappear when a programs custom colors are installed by the window manager. For example:


SaveColor
{
        BorderColor
        TitleBackground
        TitleForeground
        "red"
        "green"
        "blue"
}

This would place on the root window 3 pixel values for borders and titlebars, as well as the three color strings, all taken from the default colormap. 

ShowIconManager

This variable indicates that the icon manager window should be displayed when twm is started. It can always be brought up using the f.showiconmgr function. 

SortIconManager

This variable indicates that entries in the icon manager should be sorted alphabetically rather than by simply appending new windows to the end. 

SqueezeTitle [{ squeeze-list }]

This variable indicates that twm should attempt to use the SHAPE extension to make titlebars occupy only as much screen space as they need, rather than extending all the way across the top of the window. The optional squeeze-list may be used to control the location of the squeezed titlebar along the top of the window. It contains entries of the form:


    "name"        justification    num    denom

where name is a window name, justification is either left, center, or right, and num and denom are numbers specifying a ratio giving the relative position about which the titlebar is justified. The ratio is measured from left to right if the numerator is positive, and right to left if negative. A denominator of 0 indicates that the numerator should be measured in pixels. For convenience, the ratio 0/0 is the same as 1/2 for center and -1/1 for right. For example:


SqueezeTitle
{
    "XTerm"    left        0    0
    "xterm1"    left        1    3
    "xterm2"    left        2    3
    "oclock"    center        0    0
    "emacs"    right        0    0
}

The DontSqueezeTitle list can be used to turn off squeezing on certain titles. 

StartIconified [{ win-list }]

This variable indicates that client windows should initially be left as icons until explicitly deiconified by the user. If the optional win-list is given, only those windows will be started iconic. This is useful for programs that do not support an -iconic command line option or resource. 

TitleBackground string [{ win-list }]

This variable specifies the background color used in titlebars, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. The default is "white". 

TitleButtonBorderWidth pixels

This variable specifies the width in pixels of the border surrounding titlebuttons. This is typically set to 0 to allow titlebuttons to take up as much space as possible and to not have a border. The default is 1. 

TitleFont string

This variable specifies the font to be used for displaying window names in titlebars. The default is "variable". 

TitleForeground string [{ win-list }]

This variable specifies the foreground color used in titlebars, and may only be specified inside of a Color, Grayscale or Monochrome list. The optional win-list is a list of window names and colors so that per-window colors may be specified. The default is "black". 

TitlePadding pixels

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

UnknownIcon string

This variable specifies the filename of a bitmap file to be used as the default icon. This bitmap will be used as the icon of all clients which do not provide an icon bitmap and are not listed in the Icons list. 

UsePPosition string

This variable specifies whether or not twm should honor program-requested locations (given by the PPosition flag in the WM_NORMAL_HINTS property) in the absence of a user-specified position. The argument string may have one of 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 [{ win-list }]

This variable indicates that the pointer should be warped into windows when they are deiconified. If the optional win-list is given, the pointer will only be warped when those windows are deiconified. 

WindowRing { win-list }

This variable specifies a list of windows along which the f.warpring function cycles. 

WarpUnmapped

This variable indicates that the f.warpto function should deiconify any iconified windows it encounters. This is typically used to make a key binding that will pop a particular window (such as xmh), no matter where it is. The default is for f.warpto to ignore iconified windows. 

XorValue number

This variable specifies the value to use when drawing window outlines for moving and resizing. This should be set to a value that will result in a variety of of distinguishable colors when exclusive-or'ed with the contents of the user's typical screen. Setting this variable to 1 often gives nice results if adjacent colors in the default colormap are distinct. By default, twm will attempt to cause temporary lines to appear at the opposite end of the colormap from the graphics. 

Zoom [ count ]

This variable indicates that outlines suggesting movement of a window to and from its iconified state should be displayed whenever a window is iconified or deiconified. The optional count argument specifies the number of outlines to be drawn. The default count is 8. 

The following variables must be set after the fonts have been assigned, so it is usually best to put them at the end of the variables or beginning of the bindings sections:

DefaultFunction function

This variable specifies the function to be executed when a key or button event is received for which no binding is provided. This is typically bound to f.nop, f.beep, or a menu containing window operations. 

WindowFunction function

This variable specifies the function to execute when a window is selected from the TwmWindows menu. If this variable is not set, the window will be deiconified and raised. 

Bindings

After the desired variables have been set, functions may be attached titlebuttons and key and pointer buttons. Titlebuttons may be added from the left or right side and appear in the titlebar from left-to-right according to the order in which they are specified. Key and pointer button bindings may be given in any order.

Titlebuttons specifications must include the name of the pixmap to use in the button box and the function to be invoked when a pointer button is pressed within them:

LeftTitleButton "bitmapname" = function

or

RightTitleButton "bitmapname" = function

The bitmapname may refer to one of the built-in bitmaps (which are scaled to match TitleFont) by using the appropriate colon-prefixed name described above.

Key and pointer button specifications must give the modifiers that must be pressed, over which parts of the screen the pointer must be, and what function is to be invoked. Keys are given as strings containing the appropriate keysym name; buttons are given as the keywords Button1-Button5:

"FP1" = modlist : context : function Button1 = modlist : context : function

The modlist is any combination of the modifier names shift, control, lock, meta, mod1, mod2, mod3, mod4, or mod5 (which may be abbreviated as s, c, l, m, m1, m2, m3, m4, m5, respectively) separated by a vertical bar (|). Similarly, the context is any combination of window, title, icon, root, frame, iconmgr, their first letters (iconmgr abbreviation is m), or all, separated by a vertical bar. The function is any of the f. keywords described below. For example, the default startup file contains the following bindings:

Button1 = : root : f.menu "TwmWindows" Button1 = m : window | icon : f.function "move-or-lower" Button2 = m : window | icon : f.iconify Button3 = m : window | icon : f.function "move-or-raise" Button1 = : title : f.function "move-or-raise" Button2 = : title : f.raiselower Button1 = : icon : f.function "move-or-iconify" Button2 = : icon : f.iconify Button1 = : iconmgr : f.iconify Button2 = : iconmgr : f.iconify

A user who wanted to be able to manipulate windows from the keyboard could use the following bindings:

"F1" = : all : f.iconify "F2" = : all : f.raiselower "F3" = : all : f.warpring "next" "F4" = : all : f.warpto "xmh" "F5" = : all : f.warpto "emacs" "F6" = : all : f.colormap "next" "F7" = : all : f.colormap "default" "F20" = : all : f.warptoscreen "next" "Left" = m : all : f.backiconmgr "Right" = m | s : all : f.forwiconmgr "Up" = m : all : f.upiconmgr "Down" = m | s : all : f.downiconmgr

Twm provides many more window manipulation primitives than can be conveniently stored in a titlebar, menu, or set of key bindings. Although a small set of defaults are supplied (unless the NoDefaults is specified), most users will want to have their most common operations bound to key and button strokes. To do this, twm associates names with each of the primitives and provides user-defined functions for building higher level primitives and menus for interactively selecting among groups of functions.

User-defined functions contain the name by which they are referenced in calls to f.function and a list of other functions to execute. For example:

Function "move-or-lower" { f.move f.deltastop f.lower } Function "move-or-raise" { f.move f.deltastop f.raise } Function "move-or-iconify" { f.move f.deltastop f.iconify } Function "restore-colormap" { f.colormap "default" f.lower }

The function name must be used in f.function exactly as it appears in the function specification.

In the descriptions below, if the function is said to operate on the selected window, but is invoked from a root menu, the cursor will be changed to the Select cursor and the next window to receive a button press will be chosen:

! string

This is an abbreviation for f.exec string. 

f.autoraise

This function toggles whether or not the selected window is raised whenever entered by the pointer. See the description of the variable AutoRaise. 

f.backiconmgr

This function warps the pointer to the previous column in the current icon manager, wrapping back to the previous row if necessary. 

f.beep

This function sounds the keyboard bell. 

f.bottomzoom

This function is similar to the f.fullzoom function, but resizes the window to fill only the bottom half of the screen. 

f.circledown

This function lowers the top-most window that occludes another window. 

f.circleup

This function raises the bottom-most window that is occluded by another window. 

f.colormap string

This function rotates the colormaps (obtained from the WM_COLORMAP_WINDOWS property on the window) that twm will display when the pointer is in this window. The argument string may have one of the following values: "next", "prev", and "default". It should be noted here that in general, the installed colormap is determined by keyboard focus. A pointer driven keyboard focus will install a private colormap upon entry of the window owning the colormap. Using the click to type model, private colormaps will not be installed until the user presses a mouse button on the target window. 

f.deiconify

This function deiconifies the selected window. If the window is not an icon, this function does nothing. 

f.delete

This function sends the WM_DELETE_WINDOW message to the selected window if the client application has requested it through the WM_PROTOCOLS window property. The application is supposed to respond to the message by removing the indicated window. If the window has not requested WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that the user should choose an alternative method. Note this is very different from f.destroy. The intent here is to delete a single window, not necessarily the entire application. 

f.deltastop

This function allows a user-defined function to be aborted if the pointer has been moved more than MoveDelta pixels. See the example definition given for Function "move-or-raise" at the beginning of the section. 

f.destroy

This function instructs the X server to close the display connection of the client that created the selected window. This should only be used as a last resort for shutting down runaway clients. See also f.delete. 

f.downiconmgr

This function warps the pointer to the next row in the current icon manger, wrapping to the beginning of the next column if necessary. 

f.exec string

This function passes the argument string 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. 

f.focus

This function toggles the keyboard focus of the server to the selected window, changing the focus rule from pointer-driven if necessary. If the selected window already was focused, this function executes an f.unfocus. 

f.forcemove

This function is like f.move except that it ignores the DontMoveOff variable. 

f.forwiconmgr

This function warps the pointer to the next column in the current icon manager, wrapping to the beginning of the next row if necessary. 

f.fullzoom

This function resizes the selected window to the full size of the display or else restores the original size if the window was already zoomed. 

f.function string

This function executes the user-defined function whose name is specified by the argument string. 

f.hbzoom

This function is a synonym for f.bottomzoom. 

f.hideiconmgr

This function unmaps the current icon manager. 

f.horizoom

This variable is similar to the f.zoom function except that the selected window is resized to the full width of the display. 

f.htzoom

This function is a synonym for f.topzoom. 

f.hzoom

This function is a synonym for f.horizoom. 

f.iconify

This function iconifies or deiconifies the selected window or icon, respectively. 

f.identify

This function displays a summary of the name and geometry of the selected window. If the server supports the SYNC extension, the priority of the client owning the window is also displayed. Clicking the pointer or pressing a key in the window will dismiss it. 

f.lefticonmgr

This function similar to f.backiconmgr except that wrapping does not change rows. 

f.leftzoom

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

f.lower

This function lowers the selected window. 

f.menu string

This function invokes the menu specified by the argument string. Cascaded menus may be built by nesting calls to f.menu. 

f.move

This function drags an outline of the selected window (or the window itself if the OpaqueMove variable is set) until the invoking pointer button is released. Double clicking within the number of milliseconds given by ConstrainedMoveTime warps the pointer to the center of the window and constrains the move to be either horizontal or vertical depending on which grid line is crossed. To abort a move, press another button before releasing the first button. 

f.nexticonmgr

This function warps the pointer to the next icon manager containing any windows on the current or any succeeding screen. 

f.nop

This function does nothing and is typically used with the DefaultFunction or WindowFunction variables or to introduce blank lines in menus. 

f.previconmgr

This function warps the pointer to the previous icon manager containing any windows on the current or preceding screens. 

f.priority string

This function sets the priority of the client owning the selected window to the numeric value of the argument string, which should be a signed integer in double quotes (e.g. "999" ). This function has an effect only if the server supports the SYNC extension. 

f.quit

This function causes twm to restore the window's borders and exit. If twm is the first client invoked from xdm, this will result in a server reset. 

f.raise

This function raises the selected window. 

f.raiselower

This function raises the selected window to the top of the stacking order if it is occluded by any windows, otherwise the window will be lowered. 

f.refresh

This function causes all windows to be refreshed. 

f.resize

This function displays an outline of the selected window. Crossing a border (or setting AutoRelativeResize) will cause the outline to begin to rubber band until the invoking button is released. To abort a resize, press another button before releasing the first button. 

f.restart

This function kills and restarts twm. 

f.startwm string

This function kills twm and starts another window manager, as specified by string. 

f.righticonmgr

This function is similar to f.nexticonmgr except that wrapping does not change rows. 

f.rightzoom

This variable is similar to the f.bottomzoom function except that the selected window is only resized to the right half of the display. 

f.saveyourself

This function sends a WM_SAVEYOURSELF message to the selected window if it has requested the message in its WM_PROTOCOLS window property. Clients that accept this message are supposed to checkpoint all state associated with the window and update the WM_COMMAND property as specified in the ICCCM. If the selected window has not selected for this message, the keyboard bell will be rung. 

f.showiconmgr

This function maps the current icon manager. 

f.sorticonmgr

This function sorts the entries in the current icon manager alphabetically. See the variable SortIconManager. 

f.title

This function provides a centered, unselectable item in a menu definition. It should not be used in any other context. 

f.topzoom

This variable is similar to the f.bottomzoom function except that the selected window is only resized to the top half of the display. 

f.unfocus

This function resets the focus back to pointer-driven. This should be used when a focused window is no longer desired. 

f.upiconmgr

This function warps the pointer to the previous row in the current icon manager, wrapping to the last row in the same column if necessary. 

f.vlzoom

This function is a synonym for f.leftzoom. 

f.vrzoom

This function is a synonym for f.rightzoom. 

f.warpring string

This function warps the pointer to the next or previous window (as indicated by the argument string, which may be "next" or "prev") specified in the WindowRing variable. 

f.warpto string

This function warps the pointer to the window which has a name or class that matches string. If the window is iconified, it will be deiconified if the variable WarpUnmapped is set or else ignored. 

f.warptoiconmgr string

This function warps the pointer to the icon manager entry associated with the window containing the pointer in the icon manager specified by the argument string. If string is empty (i.e. ""), the current icon manager is chosen. 

f.warptoscreen string

This function warps the pointer to the screen specified by the argument string. String may be a number (e.g. "0" or "1"), the word "next" (indicating the current screen plus 1, skipping over any unmanaged screens), the word "back" (indicating the current screen minus 1, skipping over any unmanaged screens), or the word "prev" (indicating the last screen visited. 

f.winrefresh

This function is similar to the f.refresh function except that only the selected window is refreshed. 

f.zoom

This function is similar to the f.fullzoom function, except that the only the height of the selected window is changed. 

Menus

Functions may be grouped and interactively selected using pop-up (when bound to a pointer button) or pull-down (when associated with a titlebutton) menus. Each menu specification contains the name of the menu as it will be referred to by f.menu, optional default foreground and background colors, the list of item names and the functions they should invoke, and optional foreground and background colors for individual items:

Menu "menuname" [ ("deffore":"defback") ] {

string1    [ ("fore1":"backn")]    function1
string2    [ ("fore2":"backn")]    function2
    .
    .
    .
stringN    [ ("foreN":"backN")]    functionN

}

The menuname is case-sensitive. The optional deffore and defback arguments specify the foreground and background colors used on a color display to highlight menu entries. 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 colors 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 colors specified by the MenuForeground and MenuBackground variables. The function portion of the menu entry is one of the functions, including any user-defined functions, or additional menus.

There is a special menu named TwmWindows which contains the names of all of the client and twm-supplied windows. Selecting an entry will cause the WindowFunction to be executed on that window. If WindowFunction hasn't been set, the window will be deiconified and raised. Icons Twm supports several different ways of manipulating iconified windows. The common pixmap-and-text style may be laid out by hand or automatically arranged as described by the IconRegion variable. In addition, a terse grid of icon names, called an icon manager, provides a more efficient use of screen space as well as the ability to navigate among windows from the keyboard.

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 button using the default iconify symbol will be displayed to the left of the name when the window is iconified. By default, clicking on an entry in the icon manager performs f.iconify. To change the actions taken in the icon manager, use the the iconmgr context when specifying button and keyboard bindings.

Moving the pointer into the icon manager also directs keyboard focus to the indicated window (setting the focus explicitly or else sending synthetic events NoTitleFocus is set). Using the f.upiconmgr, f.downiconmgr f.lefticonmgr, and f.righticonmgr functions, the input focus can be changed between windows directly from the keyboard. Bugs The resource manager should have been used instead of all of the window lists.

The IconRegion variable should take a list.

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

If IconifyByUnmapping is on and windows are listed in IconManagerDontShow but not in DontIconifyByUnmapping, they may be lost if they are iconified and no bindings to f.menu "TwmWindows" or f.warpto are setup. Files

$HOME/.twmrc. $HOME/.twmrc /tmp/Xorg-KEM/lib/X11/twm/system.twmrc

Environment Variables

DISPLAY

This variable is used to determine which X server to use. It is also set during f.exec so that programs come up on the proper screen. 

HOME

This variable is used as the prefix for files that begin with a tilde and for locating the twm startup file. 

See Also

X(7) , Xserver(1) , xdm(1) , xrdb(1) Authors Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; Dave Sternlicht, MIT X Consortium; Dave Payne, Apple Computer.

Table of Contents

Name
Syntax
Description
Options
Customization
Variables
Bindings
Menus
Icons
Bugs
Files
Environment Variables
See Also
Authors

DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

#**********************************************************************

jim twmrc
.twmrc

#**********************************************************************

#IconDirectory "/users/jim/icons" # use *bitmapFilePath instead.

Use the SHAPE extension to make titles use as little space as possible. The
location of the titles is specified as a fraction of the distance from the
left (numerator positive) or right edge (numerator negative). A denominator
of 0 indicates that the numerator is measured in pixels. The title is then
justified over the indicated spot (note special cases are made for center on
0/0 and right on 0/0 to indicate the center and right edge of the titlebar).

SqueezeTitle # also sets default to Squeeze all Titles {

name justify num denom
"oclock"    center    0  0      # centered over middle of title
"XTerm" left      0  0      # left edge of title
"xlogo" right     0  0      # for kicks
"emacs" right     0  0      # left side emacs with center tab
"xmh"   center    0  0

} DontSqueezeTitle {

"XLogout"           # make it stand out when mapped

} NoDefaults # turn off iconify and resize button LeftTitleButton "menu12" = f.menu "windowmenu" # add a menu to each window TitleButtonBorderWidth 0 # don't want to see box around button ButtonIndent 0 # button doesn't have to be smaller

UsePPosition "on" # use program-specified size hints accepted NoHighlight # do not flash borders on enter events OpaqueMove # actually move window instead of outline AutoRelativeResize # don't require resize to cross border to start RestartPreviousState # reiconify iconified things on startup ClientBorderWidth # use the application border width on frame BorderWidth 2 # width of top level windows created by twm NoGrabServer # don't grab server during menus, etc. NoRaiseOnMove # allow moving under other windows NoRaiseOnResize # allow resizing under other windows NoTitleFocus # avoid keystrokes in wrong window cause of lag DecorateTransients # put titlebars on transients TitleFont "-adobe-helvetica-bold-r-normal---120------" MenuFont "-adobe-helvetica-bold-r-normal---120------" IconFont "-adobe-helvetica-bold-r-normal---100------" IconManagerFont "-adobe-helvetica-bold-r-normal---100---" ResizeFont "-adobe-helvetica-bold-r-normal---120---*" NoSaveUnders # faster to just repaint then save XORvalue 1 # tend to use visually distinct adjacent colors ConstrainedMoveTime 0 # turn off horizontal/vertical only moving NoCaseSensitive # turn off case-sensitivity in sorting icons WarpUnmapped # allow warping to unmapped windows

###############################################################################

Declare some nice colors

###############################################################################

Pixmaps {

TitleHighlight "solid4x4" # make it stand out

}

Color {

DefaultBackground "maroon"
DefaultForeground "gray85"
BorderColor "gray70"
TitleBackground "maroon"
TitleForeground "gray85"
MenuBackground "maroon"
MenuForeground "gray85"
MenuTitleBackground "gray70"
MenuTitleForeground "maroon"
IconBackground "maroon"
IconForeground "gray85"
IconBorderColor "gray85"
IconManagerBackground "maroon"
IconManagerForeground "gray85"

}

Monochrome {

IconManagerHighlight  "white"
BorderColor "black"

}

###############################################################################

Define key bindings

###############################################################################

MoveDelta 3 # need to move this much before takes effect Function "move-or-raise" # simulate uwm action {

f.move
f.deltastop
f.raise

}

DefaultFunction f.nop # ignore extraneous events

Button1 = : root : f.menu "twmops" Button2 = : root : f.menu "windowops" Button3 = : root : f.menu "TwmWindows" Button1 = : title : f.function "move-or-raise" Button1 = : icon : f.iconify Button1 = : iconmgr : f.iconify Button1 = m : window|icon|frame|title : f.lower Button2 = m : window : f.resize Button3 = m : window|icon|frame|title : f.function "move-or-raise" Button1 = c|m|s : all : f.menu "twmops" #Button1 = c|m|s : root : f.refresh #"F20" = : all : f.warptoscreen "next"

"F21" = : all : f.warpring "next" "F22" = : all : f.warptoiconmgr "" "F23" = : all : f.raiselower "Num_Lock" = : all : f.iconify "F24" = : all : f.warpto "xmh" "F25" = : all : f.warpto "[expo]" "F26" = : all : f.warpto "emacs" "KP_Subtract" = mod5 : all : f.colormap "prev" "KP_Add" = mod5 : all : f.colormap "next" "KP_Enter" = mod5 : all : f.colormap "default" "Left" = m : all : f.backiconmgr "Right" = m : all : f.forwiconmgr "Up" = m : all : f.upiconmgr "Down" = m : all : f.downiconmgr "Left" = mod5 : all : f.warpring "prev" "Right" = mod5 : all : f.warpring "next"

###############################################################################

Display an icon manager across the top of the screen. Don't manage
the windows for which you don't show a title.

###############################################################################

SortIconManager # keep them in alphabetic order ShowIconManager # start with iconmgr up IconManagerGeometry "700x50+246+2" 14 # strip across top IconRegion "200x300+950+2" North East 50 50 IconifyByUnmapping # just use icon manager IconManagerDontShow # but ignore these windows { "xclock" "xbiff" "xload" "oclock" "xcutsel" "XLogout" } DontIconifyByUnmapping # don't lose them (still in TwmWindows menu) { "xclock" "xbiff" "xload" "oclock" "xcutsel" "Untitled" } NoTitle # little programs that look like icons { "xclock" "xbiff" "xload" "TWM Icon Manager" "xcutsel" }

NoStackMode # prevent hostile clients from hosing display {

"saber"

}

WindowRing # f.warpring acts along these windows {

"XTerm"
"emacs"
"Xmh"

}

###############################################################################

Define some useful menus.

###############################################################################

menu "twmops" { "System" f.title "Restart Twm" f.restart "Exit Twm" f.quit "" f.nop "xterm" !"xterm &" "xterm -e /bin/sh" !"xterm -e /bin/sh &" "xhost +" !"xhost + >/dev/null" "xhost -" !"xhost - >/dev/null" "" f.nop "Kill" f.menu "kill" "" f.nop "Logout" f.warpto "xlogout" }

menu "windowops" { "Windows" f.title "Kill" f.menu "kill" "Save" f.saveyourself "Refresh" f.refresh "" f.nop "Iconify" f.iconify "Resize" f.resize "Move" f.move "Raise" f.raise "Lower" f.lower "Info" f.identify "Focus" f.focus "Unfocus" f.unfocus "" f.nop "Show Iconmgr" f.showiconmgr "Hide Iconmgr" f.hideiconmgr "Prev Iconmgr" f.previconmgr "Next Iconmgr" f.nexticonmgr }

menu "windowmenu" { "Iconify" f.iconify "RaiseLower" f.raiselower "Refresh" f.winrefresh "Focus" f.focus "" f.nop "Kill" f.menu "kill" }

menu "kill" {

"Send Delete"   f.delete
"Kill Window"   f.destroy

}

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

#**********************************************************************

keith twmrc
.twmrc

#**********************************************************************

IconDirectory "/users/keith/misc/bitmaps"

#NoDefaults NoVersion NoGrabServer NoRaiseOnMove NoRaiseOnResize #NoMenuShadows NoTitleHighlight NoHighlight NoTitleFocus NoSaveUnders SqueezeTitle ConstrainedMoveTime 0 DecorateTransients #TitleButtonBorderWidth 0 #ButtonIndent 0 #LeftTitleButton "iconify.bm" = f.iconify #RightTitleButton "resize.bm" = f.resize OpaqueMove #ClientBorderWidth BorderWidth 1 RandomPlacement #IconRegion "1024x250+0+600" NORTH WEST 1024 25 IconRegion "600x200-200+0" NORTH EAST 75 25 #IconRegion "200x100-0+200" WEST NORTH 25 50 TitleFont "--helvetica-bold-o-normal---140-----iso8859-1" MenuFont "--helvetica-bold-r-normal---140-----iso8859-1" IconFont "--helvetica-bold-r-normal---140-----iso8859-1" ResizeFont "--helvetica-bold-r-normal---120-----iso8859-1" IconManagerFont "--helvetica-bold-r-normal---120-----iso8859-1" #ShowIconManager SortIconManager IconManagerGeometry "=100x100-200+0"

nice colors: background of wheat, foreground of #d36

Cursors {

Button "left_ptr"
Menu "left_ptr"
Title "left_ptr"
Frame "left_ptr"
Icon "left_ptr"

}

Color {

BorderColor "black"
TitleBackground "CadetBlue"
TitleForeground "#fffff0"
MenuBackground "#fffff0"
MenuForeground "black"
MenuTitleBackground "CadetBlue"
MenuTitleForeground "#fffff0"
IconBackground "#fffff0"
IconForeground "black"
IconBorderColor "black"

}

Monochrome {

IconManagerHighlight    "white"

}

define key bindings

MoveDelta 3

Function "move-or-raise" {

f.move
f.deltastop
f.raise

}

Function "move-or-raiselower" {

f.move
f.deltastop
f.raiselower

}

Function "move-or-iconify" {

f.move
f.deltastop
f.iconify

}

Function "next-window" { }

Function "previous-window" { }

DefaultFunction f.nop

Button1 = : title : f.function "move-or-raiselower" Button2 = : title : f.menu "Title Menu" Button3 = : title : f.resize Button1 = m : window|icon : f.iconify Button2 = m : window|icon : f.function "move-or-raiselower" Button3 = m : window|icon : f.resize Button3 = c m : title : f.destroy Button1 = : root : f.menu "Hosts" Button2 = : root : f.menu "Toys" Button3 = : root : f.menu "System" Button1 = : icon : f.function "move-or-iconify"

#ForceIcons

Icons {

"Xmh"       "mail-up.bm"    # from IconDirectory
"XTerm"     "xterm.bm"  # from IconDirectory

}

#UnknownIcon "icon"

NoTitle { "clock" "oclock" "xclock" "xbiff" "xeyes" "xload" }

IconManagerDontShow {

"clock"
"oclock"
"xclock"
"xbiff"
"xeyes"
"xload"

}

menu "Hosts" { "Hosts" f.title "xenon" !"xenon &" "expo" !"expo &" "kanga" !"kanga &" "exile" !"exile &" "expire" !"expire &" "excalibur" !"excalibur &" "hpx" !"hpx &" "expo bugs" !"expo -l bugs &" "extort" !"extort &" "apx" !"apx &" "mfb" !"mfb &" "sushi" !"sushi &" "tempura" !"tempora &" }

menu "Toys" { "Toys" f.title "Jove" !"xjove &" "Mail" !"xmh &" "Manual" !"xman &" "Troff Viewer" !"xditview &" "Calculator" !"xcalc &" "Mille Bornes" !"xmille path -n .mille &" "Notepad" !"xclipboard &" "Eyes" !"xeyes &" "Lens" !"xmag &" "expo jove" !"expo xjove&" "expo mail" !"expo xmh &" }

menu "System" {

"System"        f.title
"Window ops"        f.menu "Window Ops"
"Windows"       f.menu "TwmWindows"
""          f.nop
"Refresh"       f.refresh
"Unfocus"       f.unfocus
"Show Icon Box"     f.showiconmgr
"Hide Icon Box"     f.hideiconmgr
"Version"       f.version
""          f.nop
"Restart"       f.restart
"Logout"        f.quit

}

menu "Window Ops" {

"Window Ops"        f.title
"Lower"         f.lower
"Raise"         f.raise
"Resize"        f.resize
"Move"          f.move
"Deiconify"     f.deiconify
"Iconify"       f.iconify
"Identify"      f.identify
"Focus"         f.focus
"Kill"          f.destroy

}

menu "Title Menu" {

"Lower"         f.lower
"Raise"         f.raise
"Resize"        f.resize
"Move"          f.move
"Iconify"       f.iconify
"Identify"      f.identify
"Focus"         f.focus
"Kill"          f.destroy
"Dismiss"       f.delete

}

FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Dave Lemke's .twmrc

IconDirectory "/u/lemke/lib/icons"

#AutoRelativeResize BorderWidth 3 ButtonIndent 0 ClientBorderWidth #DefaultFunction f.nop #DontMoveOff IconifyByUnmapping IconFont "-adobe-helvetica-bold-r-normal--14-100-100-100-p-82-iso8859-1" IconManagerFont "-adobe-helvetica-bold-r-normal--14-100-100-100-p-82-iso8859-1" IconManagerGeometry "=98x5-2+50" #LeftTitleButton "menu12.xbm" = f.menu "window-ops" MenuFont "-adobe-helvetica-bold-r-normal--14-100-100-100-p-82-iso8859-1" MoveDelta 5 #NoBackingStore NoDefaults NoGrabServer NoMenuShadows #NoRaiseOnDeiconify NoRaiseOnMove #NoRaiseOnResize #NoSaveUnder #NoTitleFocus #NoVersion #OpaqueMove ResizeFont "10x20" RestartPreviousState #ReverseVideo ShowIconManager SortIconManager

SqueezeTitle {

"XTerm"     center  0   0 
"Xsol"      center  0   0
"Spider"    center  0   0

}

TitleFont "-adobe-helvetica-bold-r-normal--14-100-100-100-p-82-iso8859-1" TitleButtonBorderWidth 1 UnknownIcon "ncdlogo64.xbm" #WarpCursor XORValue 1 #Zoom

DefaultFunction f.nop

Function "move-or-raise" {

f.move
f.deltastop
f.raise

}

AutoRaise {

"xtrek"
"TWM Icon Manager"
"xclock"
"xbiff"
"xeyes"

}

Cursors {

Menu    "right_ptr"

}

DontIconifyByUnmapping {

"xclock"
"xbiff"
"twmOutput"
"xload"
"oclock"
"xeyes"

}

IconManagerDontShow {

"xclock"
"xbiff"
"twmOutput"
"xload"
"oclock"
"xeyes"

}

Monochrome {

DefaultForeground   "black"
DefaultBackground   "white"
BorderColor "black"
TitleForeground "black"
TitleBackground "white"
MenuForeground  "black"
MenuBackground  "white"

}

NoTitle {

"xclock"
"xbiff"
"xload"
"TWM Icon Manager"
"FrameMaker"
"FrameWriter"
"oclock"
"twmOutput"
"xeyes"

}

buttons

Button1 = : root : f.menu "button1" Button2 = : root : f.menu "Util_menu" Button3 = : root : f.menu "Hosts_menu" Button1 = : m : f.iconify Button2 = : m : f.lower Button1 = : t : f.function "move-or-raise" Button2 = : t : f.lower Button3 = : t : f.menu "window-ops" Button1 = : i : f.iconify Button2 = : i : f.function "move-or-raise"

"F1" = : w|t|i : f.iconify "F2" = : all : f.refresh "F3" = : w|t|i : f.raise "F4" = : w|t|i : f.lower

"F5" = : w|t|i : f.zoom

menu "button1" { "Applications" f.title #"FrameWriter" !"rsh indian -n /usr/local/xframewriter $DISPLAY& " #"Q Calc " !"rsh indian -n /usr/bin/X11/xterm -display $DISPLAY -T Qcalc -e /pmax/u/demo/qsp/bin/qcalc &" #"Notepad" !"/usr/bin/dxnotepad -display $DISPLAY&" #"Calculator" !"xcalc -display $DISPLAY&" "Mail Box" !"/usr/bin/X11/xbiff -display $DISPLAY&" "Clock" !"oclock -display $DISPLAY &" "Xterm" !"/usr/bin/X11/xterm -ls -display $DISPLAY &" "Big Xterm" !"/usr/bin/X11/xterm -ls -fn 9x15 -display $DISPLAY &" "xsol" !"$HOME/games/bin/arch/xsol &" "Spider" !"$HOME/games/bin/arch/spider &" "Utility" f.title #"Focus" f.focus #"UnFocus" f.unfocus #"More.." f.title "..Hosts" f.menu "Hosts_menu" "..Applications" f.menu "Apps_menu" "..Utility" f.menu "Util_menu" "" f.title "Exit" f.quit }

menu "Hosts_menu" { "Host Connections" f.title "Almanor" !"rsh -n almanor exec /usr/bin/X11/xterm -ls -display $DISPLAY -T Almanor&" "Hamilton" !"rsh -n hamilton exec /usr/bin/X11/xterm -ls -display $DISPLAY -T Hamilton&" "Homer" !"rsh -n Homer exec /usr/bin/X11/xterm -ls -display $DISPLAY -T Homer&" "Lupine" !"TERM=xterms xterm -fn 10x20 -T lupine -e rlogin lupine&" "Ramona" !"rsh -n ramona exec /usr/bin/X11/xterm -ls -display $DISPLAY -T Ramona&" "Pagemill" !"rsh pagemill -n /usr/bin/X11/xterm -display $DISPLAY -T Pagemill -e /bin/ksh&" "Sheridan" !"rsh -n sheridan exec /usr/bin/X11/xterm -ls -display $DISPLAY -T Sheridan&" }

menu "Apps_menu" { "Applications" f.title "Man Pages" !"/usr/bin/X11/xman -display $DISPLAY&" #"Notepad" !"/usr/bin/dxnotepad -display $DISPLAY&" #"FrameMaker" !"rsh indian -n /usr/local/xframemaker $DISPLAY& " #"Calendar" !"/usr/bin/dxcalendar -display $DISPLAY &" "Clock" !"/usr/bin/X11/xclock -display $DISPLAY &" #"Rolodex" !"/usr/bin/dxcardfiler -display $DISPLAY &" #"Paint" !"/usr/bin/dxpaint -display $DISPLAY &" "Lock Screen" !"/usr/bin/X11/xlock & " "Preferences" !"/usr/bin/X11/xpref -display $DISPLAY&" "Xterm" !"/usr/bin/X11/xterm -ls -display $DISPLAY &" }

menu "Util_menu" { "Utilities" f.title "Refresh" f.refresh "twm Version" f.version "Source .twmrc" f.twmrc "Restart twm" f.restart #"Hide IconManager" f.hideiconmgr #"Show IconManager" f.showiconmgr #"Destroy All Window" !"xkill -a&" "Preferences" f.menu "Pref_menu" "TwmWindows" f.menu "TwmWindows" "Exit twm" f.quit "Window Ops" f.title "Refresh Window" f.winrefresh "Move Window" f.move "Resize Window" f.resize "Lower Window" f.lower "Raise Window" f.raise "Iconify" f.iconify "Window Info" f.identify "Destroy Window" f.destroy "Focus on Window" f.focus "Focus on Root" f.unfocus }

menu "Pref_menu" { "Preferences" f.title "Bell Loud" !"xset b 75&" "Bell Normal" !"xset b 50&" "Bell Quiet" !"xset b 25&" "Bell Off" !"xset b off&" "Mouse Fast" !"xset m 5 1&" "Mouse Normal" !"xset m 3 1&" "Mouse Slow" !"xset m 1 1&" "Screen Saver" f.menu "SSaver" }

menu "SSaver" { "Screen Saver" f.title "Blank" !"/usr/bin/X11/xset s blank -display $DISPLAY &" "No Blank" !"/usr/bin/X11/xset s noblank -display $DISPLAY &" "Saver 2 Sec." !"/usr/bin/X11/xset s 2 2 -display $DISPLAY &" "Saver 2 Min." !"/usr/bin/X11/xset s 120 120 -display $DISPLAY &" "Saver 10 Min." !"/usr/bin/X11/xset s 600 600 -display $DISPLAY &" }

menu "window-ops" { "Window Ops" f.title "Iconify" f.iconify "Refresh Window" f.winrefresh "Move Window" f.move "Resize Window" f.resize "Hide Window" f.lower "Expose Window" f.raise "Destroy Window" f.destroy "Delete Window" f.delete "Save" f.saveyourself }

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG

An Overview of twm (Tom’s Window Manager) Tom LaStrange Solbourne Computer Inc. Longmont, CO toml@Solbourne.COM ABSTRACT twm is a publicly available window manager for the X Window System Version 11. It started out as a simple reparenting window manager with much of the same capabilities found in existing window managers. Since its initial release in April 1988, it has continued to evolve from suggestions and contributions taken from the X community. Its strengths are ease of use, small code size, and feature-rich functionality. This paper focuses on the basic architecture of twm and some of the unique features which set it apart from other window managers.

1 Introduction twm is an easy-to-use window manager for the X Window System that complies with the conventions proposed in the Inter-Client Communications Conventions Manual (ICCCM). It is a reparenting window manager; thus, client programs that create windows, which have the X root window as their parent, are given a new parent. The new parent is a frame window created by twm. The frame window contains not only the window of the client but can optionally contain a title bar that contains several buttons. The title bar and title bar buttons allow the user to perform basic window manipulations such as moving and resizing without the need to simultaneously press keys on the keyboard. The title bar also displays the name of the client window. While some of the concepts described in this paper are familiar to the current twm user, many features are described that will not be available until the X11, Release 4 version of twm.

2 Basic Architecture Unlike most current X clients, twm is not based on a toolkit or widget set. It was written directly on top of the Xlib C interface. There are pros and cons to this approach. About the only disadvantage to not using a toolkit or widget set is that resource specifications for twm are specified in a separate twm initialization file rather than in the standard .Xdefaults file. Although this could be remedied, it would cause twm resources to be split across two files: the .Xdefaults file for color and variable declarations, and a twm initialization file for menus. Advantages to not using the toolkit are many, including smaller code size, better control over resource usage such as windows and pixmaps, and more flexibility. The following sections describe portions of twm in more detail.

2.1 Reparenting As previously stated, twm is a reparenting window manager. This basically means that when a client program creates a window that is a child of the X root window and maps it (attempts to make it visible), twm gets an event from the X server indicating that a window is requesting to be mapped. twm does a number of functions with this event. The most significant function is that the client window is reparented by twm. This means the client window is no longer a child of the root window; it becomes a child of a twm frame window. In addition to the frame window, twm may or may not create a title bar which is also a child of the frame window. The following diagram illustrates the hierarchy of windows in the frame. Each shade shows a different level in the

Copyright (c) 1989, Solbourne Computer Inc.

-2-

hierarchy, the lowest level is the darkest. Frame

Client

Title bar

Iconify button

Highlight bar

Focus button

Resize button

The following sections cover the frame and its function in greater detail.

2.2 The Title Bar When X Version 11 was introduced, the concept of a title bar shifted from being the responsibility of the client to being the job of the window manager. A title bar is a horizontal rectangle placed above a client window. The twm title bar has five areas of interest as show below: Iconify glyph

Window name

Highlight bar

Focus glyph

Resize glyph

By default, the title bar recognizes pointer button presses and performs certain functions depending on what button is pressed. The sensitive area is any area of the title bar not covered by one of the three glyphs. By default, pointer button one causes the window to be raised to the active position (top); that is unobscured. Pointer button two initiates a move operation, which allows the user to move the window on the screen. Pointer button three causes the window to be lowered to the bottom of the stacking order. The title bar also has the feature of resizing itself and the buttons to correspond with the font currently displaying the window name. Each area of the title bar now be described in detail.

Copyright (c) 1989, Solbourne Computer Inc.

-3-

2.2.1 The Iconify Glyph When a pointer button press is detected in this glyph, the frame window becomes unmapped (made not visible), and depending on how twm is setup, one of several actions occur. The default action is that a small icon window is mapped. The icon window typically contains two areas: an image area, and a text area which contains the icon name of the client. The icon name may or may not be the same as that displayed in the title bar. More about icons is discussed in section 6.

2.2.2 The Window Name Area The window name area contains the current name of the client window. This name may be changed by the client at any time and such a change is reflected in the title bar. A useful example is one of a terminal emulator that displays the current directory in the title bar. 2.2.3 The Highlight Bar The highlight bar is represented as a series of horizontal lines. The highlight bar is displayed within the title bar of the active window. The active window has the keyboard focus. 2.2.4 The Focus Glyph When a pointer button press is detected in this glyph, the keyboard remains focused to the client window until the user presses the focus glyph a second time or executes the twm function to focus the keyboard on the root window. By default the keyboard focus simply follows the pointer. The focus glyph is intended to look like a bull’s-eye because you need to focus on a bull's-eye in order to hit it. 2.2.5 The Resize Glyph The resize glyph allows the user to resize the client window. When a pointer button press is detected here, the cursor changes and an outline appears which represents the outline of the frame. The user may then move the pointer to any outside edge of the frame and begin resizing from that position. The resize operation is completed when the pointer button is released. The resize operation may be aborted by pressing another pointer button while in the middle of the resize operation.

3 Initialization When twm begins execution it attempts to manage each unmanaged screen being run by the X server. By unmanaged screen we mean, each screen that exists and does not currently have a window manager running. This allows you to have one window manager process running for all screens, rather than having a separate window manager process for each screen. After having found each screen being used by the X server, twm sets up default values for all variables such as color, cursors, appearence, and title bar pointer functions. Following this, twm attempts to read an initialization file. This allows the user to customize the behavior of twm. There are three different default files that twm attempts to read to get initialization information: 1. 2. 3.

$HOME/.twmrc. $HOME/.twmrc /usr/lib/X11/twm/system.twmrc

In addition to these default files, the user may also supply an initialization file by starting twm with the appropriate option. Note that the initialization file is read and parsed once for each screen being managed. This al-

Copyright (c) 1989, Solbourne Computer Inc.

-4-

lows appropriate colors to be allocated and pixmaps of the proper depth to be created for each screen. Option number one allows the user to have a separate initialization file for each screen. This is useful for the user who needs a different environment on each screen. If no initialization file is found with a screen number suffix, the $HOME/.twmrc file is attempted. If multiple screens are being managed but the same environment is desired on all screens, this is the only file that needs to be present. If no local initialization files are found, a system initialization file is used. This system initialization file can be setup such that new users do not have to get a copy of an existing initialization file, a system wide default can be setup here. This system initialization file is not read if a local initialization file is found.

4 Window Manager Functions All window managers provide some basic functions. These functions include such common operations as raising, lowering, iconifying, and resizing of windows. We have already described the default functions that are available from the title bar, but this is only a small set of the available functions. There are currently more than 50 twm functions that allow the user to control the appearance of the screen, the keyboard focus, and the general operation of the window manager. twm functions can be executed in three different ways: 1 From a pointer button press 2 From a keyboard key press 3 From a menu A context in which to execute the function and any modifier keys needed may also be specified. The context simply specifies, with one exception, where the pointer needs to be positioned before the function executes. The following contexts may be specified with pointer button and keyboard key specifications. root frame title window icon iconmgr all

Execute the function if the pointer is in the root window. Execute the function if the pointer is in the twm frame. Execute the function if the pointer is in the title bar. Execute the function if the pointer is in the client window. Execute the function if the pointer is in the associated icon window. Execute the function if the pointer is in the icon manager entry. Execute the function no matter where the pointer is.

The boldfaced letter of each context shows the one letter abbreviation for each context. In addition to these contexts, a double quoted string may also be specified for functions tied to a key on the keyboard. Modifier keys may also be specified that need to be pressed before the function executes. twm recognizes the following modifier keys: shift

The

Shift

key

control meta

The Control key The meta key. The keyface will vary depending on what keyboard you are using.

Once again, the boldface letter indicates the one letter abbreviation that may be used. The format of a pointer button or keyboard key specification is as follows: [button | key] = [modifiers] : context : function

Copyright (c) 1989, Solbourne Computer Inc.

-5-

Now for some examples: Button1 Button2 "F1"

=

= shift

: root : f.menu "system menu" : tfwi : f.function "raise-lower-move" : t|f|w|i: f.raise

The first example pops up the menu "system menu" when pointer button one is pressed in the root window. The second executes the function stream "raise-lower-move" if the pointer is in a title bar, a frame, a client window, or an icon. The third example executes the f.raise function if the pointer is in a title bar, a frame, a client window, or an icon, and the F1 key is pressed while the Shift

key is held down.

4.1 Function Streams Function streams provide the user the ability to execute multiple functions with one action. A function stream is nothing more than a list of functions to execute. An invocation of a function stream can be seen in the previous section with the command f.function. We’ll go through two examples on function streams to give an idea of how they might be used. The first example defines a function that raises the window and focuses the keyboard to it when pointer button one is pressed within the client window. This would be useful in setting up a click-to-type environment, where the user is required to click a pointer button in a window in order to enter text. Button1= : window : f.function "raise-n-focus" Function "raise-n-focus" { f.raise f.focus } The second example shows an extremely useful one for those with a one button pointer. It simply implements a function that allows the user to raise, lower, or move the window with one pointer button pressed in the title bar. MoveDelta 5 Button1= : title: f.function "raise-lower-move" Function "raise-lower-move" { f.move f.raiselower } When pointer button one is pressed in the title bar of any window the "raise-lower-move" function is executed. The f.move function is executed and if the pointer is moved more than five pixels, the window move is performed. If the pointer is not moved more than five pixels, the f.raiselower function is executed.

Copyright (c) 1989, Solbourne Computer Inc.

-6-

5 Variables twm has a number of variables that control the appearence and operation of the window manager. The variables can be categorized into a few different groups: • • • •

Color variables Cursor variables General appearence variables Icon variables

5.1 Color Variables There are a number of variables that configure the color of twm created windows. Configureable areas include: • • • •

Title bars Icons Icon manager entries Menus

Color variables are specified within a Color List. A color list begins with either Color or Monochrome and simply contains the individual color variables. This scheme allows you to use the same initialization file when running on either a color or monochrome system. In addition, most colors allow client or class specific colors to be specified so that groups of windows can share the same colors. For example: Color { TitleForeground "black" { "XTerm" "blue" "fred" "green" } TitleBackground "white" { "XTerm" "grey" "fred" "yellow" } } This example shows several things, it first sets the default title bar foreground color to black and the default title bar background color to white. Following the defaults, we see some client specific settings. If a window were created that had a class or name of XTerm, the foreground and background colors of the title bar would be set to blue and grey, respectively. If a window is created that has a class or name of fred, the title bar foreground and background colors would be set to green and yellow. The name matching algorithm that twm uses matches a client name before a class name, so if a window were created that had a class of XTerm and a name of fred, the title bar foreground and background would be set to green and yellow. 5.1.1 Menu Colors While the default menu colors are specified in a color list, menu colors can also be specified in the menu definition itself. This allows the user to have different colors for each menu item. The following example shows setting up of the default menu colors and also defining colors on a per entry basis in a menu.

Copyright (c) 1989, Solbourne Computer Inc.

-7-

Color { MenuForeground "black" MenuBackground "white" MenuTitleForeground "white" MenuTitleBackground "black" } Menu "An Example" ("white" : "red")

this is the highlight color

{ "Window Ops" ("white" : "green") f.title "Raise Window" f.raise "Lower Window" f.lower "(De)Iconify" f.iconify "Move" ("white" : "red") f.move } Setting up the default colors is fairly straightforward, let’s look at the menu. The color specification for menu items has the form: ( "foreground" : "background" ) The color specified on the line with the Menu keyword specifies the colors to be displayed when the pointer is in a menu entry. We also see that two of the entries in the menu contain color specifications. These entries are displayed with the colors they have requested. It gets better, twm also has the capability to interpolate colors between menu entries. If we were to put the keyword InterpolateMenuColors in our initialization file, our example menu would have entries with the background of each entry interpolated from green to red.

5.2 Cursor Variables Variables exist to customize the appearence of the cursor (pointer image) when positioned within twm windows and when executing certain commands. The cursor may be taken from one of the predefined cursors in the cursor font or may be a custom cursor created from bitmap files. The following list specifies the cursors that can be customized and where/when the cursor is displayed. • • • • • • • • • • •

Frame Title Icon IconMgr Move Resize Menu Button Wait Select Destroy

the window frame in the title bar in icons in an icon manager during window movement during a window resize operation in a pop up menu in a title bar or icon manager button when twm is busy when twm is waiting for the user to select a window for an operation when a window needs to be chosen to be destroyed

Copyright (c) 1989, Solbourne Computer Inc.

-8-

6 Icons Icons are a concept supported by most window managers. An icon is simply a postage stamp sized window that is displayed instead of a larger client window. When a window is temporarily not needed, the user may choose to turn it into an icon thereby saving screen real estate. twm supports icons in two ways, traditional icons and through the use of an Icon Manager.

6.1 Traditional Icons A traditional icon is typically a small window containing two distinct areas: an image area and a text area. The image area usually contains a small graphical representation of the client while the text area contains textual data that describes the client. A traditional icon can also have just a text area with no image area. Below are examples of traditional icons.

The two icons on the left illustrate icons with both an image area and a text area. The icon on the right is textual only. Variables are available that allow customization of the appearence of icons. These variables allow the user to specify foreground, background, and border colors for the icons. You can also provide a list of bitmap files to use as the icon images. Icons in twm are active. An active icon is one that enables you to position the pointer on top of the icon, type keys on the keyboard, and have those keystrokes directed to the client. This assumes of course that the keyboard focus has not been explicitly set to a certain client.

6.2 Icon Managers In addition to traditional icons, twm introduces a new concept called an Icon Manager. An icon manager is simply a window where placeholders for clients are created and always displayed. An icon manager can be used in conjunction with traditional icons or in place of traditional icons. Icon managers have clear advantages over traditional icons. These advantages include the following: • Group icon icons together • Typically take up less screen real estate than traditional icons • Allow an almost mouse-free environment to be created About the only disadvantage to using an icon manager is that there is not a user definable image area in an icon manager entry. The following illustration is how a typical icon manager may appear:

Copyright (c) 1989, Solbourne Computer Inc.

-9-

This particular icon manager has three columns and currently contains eight entries, three of which are currently iconified. An icon manager is pretty much like any normal client window on the screen. If desired, it can have a title bar and can be moved, resized, raised, and lowered, like any other window. The icon manager can even be iconified! In the above illustration, the clients myhost, xmh, and one of the xterm windows are currently iconic. A window in an iconic state has a small glyph displayed to the left of the name, it is a replica of the iconify glyph used in the title bar. By default, a pointer button press in either the icon manager entry or the small iconify glyph either iconifies or deiconifies the client depending on its current state. The client named george shows a darkened area around its entry. This darkened outline indicates that it is the client that currently has the keyboard focus. As you move the pointer between clients, you will typically see the active icon manager entry also changing. You will also notice that the entries in this particular icon manager are sorted. The default behavior of twm is simply to place new entries at the end of the icon manager, but there does exist a variable that turns on a sorting function for the icon manager. There also exists a function to force an icon manager to be sorted. If the name of an entry were to change and the icon manager entries were being sorted, the icon manager would be resorted. Icon manager entries are also active in the same way the traditional icons are active. If the pointer is positioned over an icon manager entry and keys on the keyboard are pressed, the characters are sent to the clients top level window. twm supports multiple icon managers and each may have one or more columns. Multiple icon managers are useful for grouping windows together. For example you could have an icon manager that would hold all xterm windows, have another that would hold windows associated with a CAD package, and so on. The following example from an initialization file shows how you might set up multiple icon managers: IconManagers { "Frame" "XTerm" "CAD" }

"=100x5+10+10" "=300x5+120+10" "=200x5+500+10"

1 3 2

This example would cause three icon managers to be created, one that would have entries for windows with a class or name of “Frame,” one for windows that have a class or name of “XTerm,” and one for windows with a name or class of “CAD.” There is also a default icon manager created that can contain any entries not picked up by a specific icon manager. The number following the geometry specification is the number of columns that the icon manager should display. These icon managers will not become visible until they have at least one entry, and will be unmapped when they have no entries. 6.2.1 An Almost Mouse-free Environment Using Icon Managers As we stated in the previous section, it is possible to setup an environment where the pointer would only be needed to move and resize windows, and to pop up menus. Just about every other twm function can be executed from the keyboard. One of the contexts available to define keyboard and pointer functions is iconmgr. This context is used when the pointer is positioned in an icon manager entry. When a function is executed with this context, the operation is performed on the corresponding client window. Let’s take for example the following keyboard function definition: "F1" = : iconmgr

: f.raise

This key definition would cause the client window to be raised when the pointer is in an icon manager entry and the F1 key is pressed.

Copyright (c) 1989, Solbourne Computer Inc.

- 10 -

Now let’s setup our mouse-free environment using some of the other available functions:

NoTitleFocus "R3" = "Up" = "Down" = "Left" = "Right" = "Left" = shift "Right" = shift "F1" = "F2" = "L1" =

: : : : : : : : : :

all iconmgr iconmgr iconmgr iconmgr iconmgr iconmgr all all all

: : : : : : : : : :

f.warpto "XTerm Icon Manager" f.upiconmgr f.downiconmgr f.lefticonmgr f.righticonmgr f.previconmgr f.nexticonmgr f.raise f.lower f.iconify

6.2.2 Summary Now let’s see what we’ve got.

Regardless of the pointer’s current position when the

R3

is pressed, the

pointer is warped to the XTerm icon manager window. Now that we’re in the XTerm icon manager, the ,

, and

,

keys have been defined to allow you to move around the icon manager. Because the icon

manager entries are active, you can simply type on the keyboard while the pointer is in an entry and the keystrokes are directed to the client. We have also set up the F1 key to raise the window, the F2 key to lower the window, and the L1 key to iconify the window. These functions are executed when the pointer is in an icon manager entry. The user can also use those keys when the pointer is positioned in the title bar or main window of a client. Additionally, the and keys can be used in conjunction with the Shift key, to warp the pointer between icon managers. These functions will not only warp between icon managers on a single screen but will also warp the pointer to visible icon managers on other screens being managed by twm. The symbols used here for keyboard keys, may or may not be present on your keyboard.

7 Conclusion twm fills a void in the standard X Version 11 release because it provides the novice X user with a friendly easy to use interface to the X Window System. twm also provides advanced features for the more experienced user. Because it is not based on a toolkit or widget set, server resources have been kept to a minimum as well as obtaining the best possible performance.

Copyright (c) 1989, Solbourne Computer Inc.

HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

I am using a system that runs twm and I am wondering if it is possible to switch between windows using keyboard shortcuts, as I do in gnome with Alt+Tab. x11 keyboard-shortcuts window-management twm

The f.warpring function is close, but you have to define a list of windows that are part of the ring, and there doesn't seem to be a way to say "all of them". This, for example, sets up Alt+Tab and Shift+Alt+Tab to cycle among xterms:

WindowRing { "XTerm" } "Tab" = m : all : f.warpring "next" "Tab" = m | s : all : f.warpring "prev"

Have you tried the icon manager? It shows a 2-dimensional grid of window names and you can bind keys to up, down, left, and right in the grid. Here's a fragment of my setup:

ShowIconManager IconManagerGeometry "320x200+0+0" 3 "h" = m | c : all : f.lefticonmgr "j" = m | c : all : f.downiconmgr "k" = m | c : all : f.upiconmgr "l" = m | c : all : f.righticonmgr

Window selection using Ctrl + Alt + the vi cursor keys. Hooray for unix!

Truly the biggest thing that makes twm an improvement over window managers of the gnome generation is that all of the features I just showed you are properly documented ("properly" means "in the man page"). The configuration file is not SGML/XML-ish; it's intended to be understood by humans, and edited with an editor, not a maze of menus on top of 3 layers of configuration-abstraction-libraries.

I am using a system that runs twm and I am wondering if it is possible to switch between windows using keyboard shortcuts, as I do in gnome with Alt+Tab. x11 keyboard-shortcuts window-management twm

The f.warpring function is close, but you have to define a list of windows that are part of the ring, and there doesn't seem to be a way to say "all of them". This, for example, sets up Alt+Tab and Shift+Alt+Tab to cycle among xterms:

WindowRing { "XTerm" } "Tab" = m : all : f.warpring "next" "Tab" = m | s : all : f.warpring "prev"

Have you tried the icon manager? It shows a 2-dimensional grid of window names and you can bind keys to up, down, left, and right in the grid. Here's a fragment of my setup:

ShowIconManager IconManagerGeometry "320x200+0+0" 3 "h" = m | c : all : f.lefticonmgr "j" = m | c : all : f.downiconmgr "k" = m | c : all : f.upiconmgr "l" = m | c : all : f.righticonmgr

Window selection using Ctrl + Alt + the vi cursor keys. Hooray for unix!

############ insert ############ to alt-tab this works for me ###########################

Keys

"Tab" = m : all : f.circleup

############################################################################################ Truly the biggest thing that makes twm an improvement over window managers of the gnome generation is that all of the features I just showed you are properly documented ("properly" means "in the man page"). The configuration file is not SGML/XML-ish; it's intended to be understood by humans, and edited with an editor, not a maze of menus on top of 3 layers of configuration-abstraction-libraries.

8888888888888888888888888888888888888888888888888888888888888888888888

Yes, the "Ring" needs the names of the programs which will be included in it. But, assuming all windows you have also yield an icon, you can navigate over the Icon Manager by programming keys (I use Shift, Alt or Ctrl and F9, F10 and F11 to move left, right or down and F12 to deiconize the Icon Manager if it gets iconized. This will work whether the window is iconized or not.

For stacked windows, I likewise use F5 and F6 to up or down the stack, and this works whether or not the windows are in the "Ring" or not. I have F7 and F8 to go left and right in the "Ring".

You can also hit Shift and Num Lock to turn the numeric pad into mouse movement keys, with Num Lock, / and * then acting as the left, center and right mouse buttons, and 5 to emulate a click. Turn that functionality off by hitting Shift and Num Lock again.

As to the "focus", you can make it operate like on windows (i.e. click to get focus on a window with the f.focus function. See the manpage).

You can do quite clever stuff with .xsession, .Xresources and .twmrc files in combination. On some X11 setups, the first two will be .xinitrc and .XDefaults but fill the same roles.

I've been using twm for 20 years, fast, reliable, no clutter, and supports multiple logins over a client server network (GNOME and KDE tend to dislike multiple sessions).

88888888888888888888888888888888888888888888888888888888888888888888888

https://www.reddit.com/r/openbsd/comments/7flgc9/twm_30_years_on_thanks_tom_lastrange/

twm 30 years on ... thanks Tom LaStrange https://www.reddit.com/r/unixporn/comments/7933ei/twm_nerd_ama_i_am_tom_lastrange_i_started_writing/

twm recently celebrated its 30th birthday and in recognition I've had a look-see. Desktop icons ... not so nice however the iconmanager is OK especially if you colour code programs/menus. twm slider style menu ... again not so nice, but add in yad and you can replace the twm menu for something more gtk'ish (or at least relegate the twm menu to being more for less frequently used system controls).

I have iconmgr running top left downwards and gkrellm in the top right. The normal press desktop to show twm menu has been replaced with a click to activate yad menu (I have it set to the right mouse button) https://s33.postimg.org/ezzq57c0v/image.jpg I also have it set so that clicking the first (left hand) button in a window title shows iconmgr and a right click of the window titlebar reveals the yad menu, the same as clicking the desktop. That way I can get to other programs/windows easily from within a full screened window, and/or invoke the menu without having to find a bit of free desktop space to click to get to the menu.

So far I've added yad scripts to provide a diary, alarms and created a button based launch 'Utilities' type dialog. A reasonable OpenBSD twm-DE (twm is a integral part of X11) with relatively few additional programs needing to be added. All I've added are ...

$ pkg_info -mz firefox-esr-- geany-- gkrellm-- libreoffice-- mpv-- mtpaint-- pcmanfm-- xdotool-- xv-- yad-- $

Follow my anniversary celebration of twm (yad scripts etc.) here ... https://www.linuxquestions.org/questions/%2Absd-17/twm-maximise-maximize-4175618143/

88888888888888888888888888888888888888888888888888888888

Motho ke motho ka botho K.Mandla's blog of Linux experiences

twm, because what’s old is what’s new 1 Reply

I saw a screenshot for twm last week, and it inspired me enough to swing past it for the a couple days. This was my inspiration:

twm

What I managed to create was:

2014-05-07-6m47421-twm-rhapsody-palemoon-vim

That’s Arch Linux again, and it was not the terribly long and uphill journey you might imagine. If you’ve ever worked with Openbox, you’ll have no problem getting twm to do something similar. And in some ways, twm has an edge.

For one, twm is incredibly fast. Window moving and resizing are exceptionally quick, even on decade-old hardware. htop says it’s taking up less than 0.3 percent of the memory out of 1Gb available, which suggests less than 400Kb, while managing five or six windows. To the side of that machine I have a D830 with 4Gb of memory in it running Musca, and the difference is between the window managers is trivial.

Also on the plus side: Most everything you could want to do with twm — colors, borders, menus and submenus — is done in one configuration file, and in a straightforward arrangement.

You can specify per-application settings, desktop-wide color schemes, and exact per-window cursor behavior. You can even jam theme settings directly into your menu, and twm handles it with grace.

It’s simple, and doesn’t have too many frills to distract you. It keeps things clean and fast, but doesn’t become the tiling window manager du jour.

Of course, there are some things I don’t like about twm, or things that I’m used to that I find it difficult to work without. To wit:

First and most obvious, twm’s focus model. I realize this dates back a human generation, but it’s immensely irritating. A window has focus when the mouse moves over it. But that does not raise it, which means grazing the touchpad or bumping the mouse while you type sends commands into the next window … or into the ether.

Similarly (and this is a little hard to explain), it also means when you spawn windows, they are not necessarily focused. Start an application and you get a ghost frame that you can maneuver into place, then click to drop. It’s a good idea, and makes things very fast for older hardware.

However, if you click and don’t shift the mouse back over the same window, it doesn’t have focus. Which means you have to learn the habit of spawn-shift-drop-then-mouse-over, to actually use the program.
The rules to raise windows are a bit strange too. You can give focus to a window by mousing over it; that we already discussed. You can click on a window, and again, it has focus. But a window doesn’t raise to the top layer until you click specifically on the title bar.

Unfortunately, that means if you’re like me and you have a tendency to “lose” applications in the stack on your desktop, you might end up shuffling things around to find out what the heck you’ve been typing, and see the whole application. Needless to say, it takes some getting used to.

There are no layering options for pinning windows to the top, or trapping them at the bottom. Those are features from IceWM and Openbox that, believe it or not, I need on a daily basis.
I’m not a fan of the icon manager. I can’t explain that any more than to say try it, and see if it strikes you as cumbersome too. I’m used to a middle-click in Openbox that shows every window, minimized or not, and you can jump straight to them. Since the iconmanager is not quite a panel, it behaves more like a hidden application that holds all the icons that are running, which has to be unminimized in order to unminimize something else. 😕
As best I can tell, twm can’t do xft fonts in borders. I might be mistaken and maybe there’s a patch, but I saw/found nothing to suggest otherwise. Of course, that may be part of what makes it fast. And of course, your applications can use xft fonts, so it’s not a hindrance.
There are plenty of options for custom mouse clicks, but I had difficulty getting Mod4+Key hotkeys set up. I don’t think twm was ever really meant to spit out a file manager when I press Mod4+2, or trigger gmrun with Alt+F2. I should really try that again, though.

I know some of these things could be corrected, or at least sidestepped, with a little more time and a little more trial-and-error in my .twmrc file. After a while though, I grew disinterested. I am ashamed. 😳

I have some other minor complaints, but I don’t want you to get the impression that twm was a bad experience. If you run your Openbox sessions close to the bone, or if you can live without all the doodads that come bundled in IceWM, or if you like tiling window managers but you’re homesick for something with a title bar on it, twm is not a bad option. I might use it again, on something with less muscle.

For what it’s worth, and for my own reference later, I’ll drop my .twmrc file here, after the more tag. If you need better ideas or a few other options to spur your interest, try Graham’s TWM page, which helped me build my .twmrc much quicker than picking through the man page. Oh, and of course, xwinman.org has a page on twm and its cousins. Oddly enough, the Arch Wiki page on twm is a bit scant. Perhaps I should do something about that. 😐

Settings effecting window borders etc ------------------------------------------

MenuFont "-xos4-terminus-medium-r-normal---120---c--paratype-pt154" TitleFont "-xos4-terminus-medium-r-normal---120---c--paratype-pt154" IconManagerFont "-xos4-terminus-medium-r-normal---120---c-*-paratype-pt154"

BorderWidth 1 # Number of pixels for border around entire window ButtonIndent 2 # Larger seems to squash buttons together FramePadding 1 # Number of pixels between titlebar buttons & frame MenuBorderWidth 1 # Number of pixels for menu border TitleButtonBorderWidth 0 # Number of pixels for button border TitlePadding 2 # Number of pixels around title buttons

NoAutoRaise # Don't raise windows just because of cursor hover NoMenuShadows # No shadow behind the menu AutoRelativeResize # Normal resize behavior NoHighlight # Don't stipple borders DontMoveOff # Enforces screen edge borders

Title bar buttons

IconDirectory "/home/kmandla/.config/twm/icons" # Directory for non default icons LeftTitleButton "resize.xbm"=f.resize RightTitleButton "minimize.xbm"=f.iconify RightTitleButton "maximize.xbm"=f.fullzoom RightTitleButton "close.xbm"=f.delete

# -------------------------------------------------------------------------------

Color {

BorderColor     "#303639"
DefaultBackground   "White"
DefaultForeground   "Black"

TitleBackground     "Firebrick"
TitleForeground     "White"

MenuTitleBackground "Firebrick"
MenuTitleForeground "White"

MenuBackground      "#FFFFFF"
MenuForeground      "#303639"

MenuShadowColor     "#303639"
MenuBorderColor     "#303639"

PointerForeground   "black"
PointerBackground   "white"

}

xsetroot -solid "#05806d" looks good with this.

MoveDelta 1 Function "move-or-lower" { f.move f.deltastop f.lower } Function "move-or-raise" { f.move f.deltastop f.raise } Function "move-or-iconify" { f.move f.deltastop f.iconify }

Button3 = : root : f.menu "main" # Openbox-style right-click for menu Button2 = : root : f.delete Button3 = m4 : root : f.menu "system" # Super_L plus right-click for "system" menu

Button1 = m : window|icon : f.function "move-or-lower" Button2 = m : window|icon : f.iconify Button3 = m : window|icon : f.function "move-or-raise"

Button1 = : title : f.function "move-or-raise" Button2 = : title : f.raiselower Button3 = : title : f.iconify

Button1 = : icon : f.function "move-or-iconify" #Button2 = : icon : f.destroy Button3 = : icon : f.iconify

Button1 = : iconmgr : f.iconify Button2 = : iconmgr : f.destroy Button3 = : iconmgr : f.iconify

LeftTitleButton "/usr/X11R6/include/X11/bitmaps/xm_noenter16" = f.delete

menu "main" {

"TWM"           f.title
"Web browser"       f.exec "palemoon &"
"File manager"      f.exec "urxvtc -e mc"
"Terminal emulator" f.exec "urxvtc"
""                  f.nop
"Applications"      f.menu "applications"
"System"        f.menu "system"

}

menu "applications" {

"Games"     f.menu "games"
"Network"   f.menu "network"
"Tools"     f.menu "tools"

}

menu "games" {

"cataclysm-dda" f.exec "urxvtc -title cataclysm -e cataclysm"

}

menu "network" {

"Pale Moon" f.exec "palemoon &"
"Pidgin"    f.exec "pidgin &"

}

menu "tools" {

"alpine"    f.exec "urxvtc -title alpine    -e alpine -d 0"
"elinks"    f.exec "urxvtc -title elinks    -e /home/kmandla/.scripts/elinks.sh"
"hnb"       f.exec "urxvtc -title hnb   -e hnb /home/kmandla/hold/notes.hnb"
"mc"        f.exec "urxvtc          -e mc" 
"mocp"      f.exec "urxvtc          -e mocp"
"rhapsody"  f.exec "urxvtc -title rhapsody  -e /home/kmandla/.scripts/chatnews.sh"
"sc"        f.exec "urxvtc          -e sc"
"slrn"      f.exec "urxvtc -title slrn  -e slrn -h news://news.aioe.org -f /home/kmandla/.config/.jnewsrc"
"vim"       f.exec "urxvtc          -e vim"

}

menu "system" {

"System monitor"    f.exec "urxvtc -e htop"
"Network manager"   f.exec "urxvtc -e wicd-curses"
""      f.nop
"Graphical"     f.menu "graphical"
"Audio"         f.menu "audio"
""      f.nop
"Icon manager"  f.showiconmgr
"Redraw"    f.refresh
"Restart"   f.restart
"Quit"      f.quit

}

menu "graphical" {

"Set background"    f.exec "feh -d. -B black -g 800x600 wallpaper/ &"
""          f.nop
"Screenshot"        f.exec "/home/kmandla/.scripts/screenshot.sh"
"App shot"      f.exec "/home/kmandla/.scripts/appshot.sh"

}

menu "audio" {

"Adjust"    f.exec "urxvtc -title alsamixer -e alsamixer"
"Equalizer" f.exec "urxvtc -title alsaequal -e alsamixer -D equal"
""      f.nop
"Mute"      f.exec "/home/kmandla/.scripts/mute.sh"
"Reset"     f.exec "/home/kmandla/.scripts/volumes.sh"

}

Cursors {

Frame     "left_ptr"
Title     "left_ptr"
Icon      "left_ptr"
IconMgr   "left_ptr"
Move      "fleur"
Resize    "fleur"
Menu      "hand1"
Button    "hand2"
Wait      "clock"
Select    "dot"
Destroy   "pirate"

}

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

links:

rufwoof https://www.linuxquestions.org/questions/*bsd-17/twm-maximise-maximize-4175618143/

Twm (tab window manager) Love by fuut1 https://www.deviantart.com/fuut1/art/Twm-tab-window-manager-Love-735437613

Nztux https://github.com/Nztux/twm/tree/master/o

K.Mandla's blog of Linux experiences https://kmandla.wordpress.com/2014/05/09/twm-because-whats-old-is-whats-new/

Graham's TWM Page! http://www.custompc.plus.com/twm/twmrc.htm

man page https://www.x.org/releases/X11R7.6/doc/man/man1/twm.1.xhtml

forums.freebsd https://forums.freebsd.org/threads/twm-tab-window-manager.466/page-2

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

https://opensource.com/article/19/12/twm-linux-desktop Get back to basics with the TWM Linux desktop This article is part of a special series of 24 days of Linux desktops. TWM may be bare-bones by default, but it's a great foundation for a customized Linux desktop that has all your favorite bits and pieces. 23 Dec 2019 Seth Kenlon (Red Hat) Feed 29 up 1 comment Penguin driving a car with a yellow background Image by : Internet Archive Book Images. Modified by Opensource.com. CC BY-SA 4.0 x Subscribe now

Get the highlights in your inbox every week.

The most humble of window managers, TWM, is a little akin to those sample photographs you get when you buy a picture frame. It's basic, almost a bare-minimum proof of concept that Xorg ships with the X11 Windows System to demonstrate that a desktop can indeed be created for a graphical user interface (GUI).

Some distributions treat it as a fallback window manager that can be launched in a pinch if you break your usual desktop and need a terminal just long enough for repairs. Now that Xorg is basically bulletproof and moving aside for Wayland, sometimes TWM isn't even included at all. And yet, amazingly, TWM, short for either Timeless Window Manager or Tabbed Window Manager, depending on who you ask, has some fun features and configuration options.

advent-twm.jpg TWM

Your distribution (XQuartz on Mac OS included) may discreetly include TWM as a fallback window manager. Otherwise, you are likely to find it in your software repository, and you can also get it from the Freedesktop GitHub repository. If you're already running a different desktop, it's safe to install TWM on the same system because it doesn't include any bundled applications aside from a few configuration panels.

After installing, log out of your current desktop session so you can log into TWM. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging into your new one.

With GDM:

advent-gdm.jpg Selecting your desktop in GDM

With SDDM:

advent-kdm.jpg Selecting your desktop in KDM Desktop tour

TWM's basic configuration is usually unspectacular. Here's TWM on my Slackware system:

advent-twm-basic.jpg TWM by default

You can get a pop-up menu with a left-click on the desktop. By default, it has one application listed: xterm. When you launch xterm, the outline of a window appears until you click to place it on the desktop.

More actions are available with a right-click or a middle-click on the desktop or a window's title bar. For instance, to resize a window, you can middle-click the title bar and select Resize; this places you into resize mode so you can drag your mouse across the edge of the window you want to make smaller or larger. Click again to confirm the new size.

When you right-click the icon in the upper-left corner of any window, that window is minimized into a desktop icon (a precursor to the OS X dock). You can drag this icon anywhere on your desktop and right-click on it to restore it back to a full-sized window.

These are all old Unix conventions; tricks of the visual interface that long-time Unix users will remember fondly but are utterly baffling at first to new users. You can learn to love them by using TWM, but if you do that, you'll no doubt want something a little prettier and more tailored to your daily workflow. TWM configuration

More Linux resources

Linux commands cheat sheet
Advanced Linux commands cheat sheet
Linux networking cheat sheet
SELinux cheat sheet
Linux common commands cheat sheet
What are Linux containers?
Our latest Linux articles

One of my favorite sites is Linux Questions, a tried-and-true Linux support forum. I stumbled across a post there about TWM, where user rkfb was, apparently in all seriousness, praising TWM as his favorite lightweight window manager. What's more, rkfb had the config file to prove it.

I downloaded the sample .twmrc file and discovered that there are a surprising number of options and features in TWM. Like other "building-block" window managers, such as FVWM or MLVWM, it takes a lot of work to customize it and bring it up to modern expectations. You can also add the usual laundry list of applications to TWM. For instance, you could run Tint2 or Xfce-panel to provide a traditional taskbar and other applets, or stalonetray for a system tray, and vdesk to provide virtual desktops, but then again, TWM isn't meant to be a modern window manager, but a timeless window manager. You may not want to make it too modern.

There are lots of options and definitions in the config file for TWM. Two of my favorites are RandomPlacement (an option to activate random placement of windows, so you don't have to manually click to set the location of each window you launch) and ShowIconManager (which displays a vertical taskbar).

The syntax to define the contents of the menus is pretty easy to understand:

menu "Shells" { "Shells" f.title "rxvt" f.exec "urxvt -fg cyan -bg black -cr white &" "Konsole" f.exec "konsole &" }

Color themes are similarly intuitive from the sample file.

You can set a background using the feh command (you probably need to install it first):

$ feh --bg-fill ~/christopher-burns_unsplash.jpg

Old TWM is new TWM

TWM looks and feels like an artifact of a bygone era, when desktops were simpler in design but complex in configuration. It's probably not the best or the most flexible window manager available, but it's surprisingly configurable. You can use it as the foundation of a customized desktop consisting of all your favorite desktop bits and pieces. You can spend the time to make TWM something you enjoy using, and you'll learn a lot about interface design, Unix history, and pixmap bit depth along the way. Give TWM another look, and make that look beautiful. 5 pengiuns floating on iceburg Customize your Linux desktop with KDE Plasma This article is part of a special series of 24 days of Linux desktops. If you think there's no such thing as too much opportunity to customize your desktop, KDE Plasma may be for you. Seth Kenlon (Red Hat) and old computer and a new computer, representing migration to new software or hardware Revamp your old Linux desktop with Joe's Window Manager This article is part of a special series of 24 days of Linux desktops. JWM's meager weight and simplicity makes it a great window manager for slow or old Linux computers. Seth Kenlon (Red Hat) Person typing on a 1980's computer Build a retro Apple desktop with the Linux MLVWM This article is part of a special series of 24 days of Linux desktops. What if old-school Apple computers were built around open source POSIX? You can find out by building the Macintosh-like Virtual Window Manager. Seth Kenlon (Red Hat) Topics Linux About the author image from https://openclipart.org/detail/196235/penguin-profile-medalion Seth Kenlon - Seth Kenlon is an independent multimedia artist, free culture advocate, and UNIX geek. He has worked in the film and computing industry, often at the same time. He is one of the maintainers of the Slackware-based multimedia production project, http://slackermedia.info More about me

Learn how you can contribute

KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK