Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

The twm Window Manager

The twm, or Tab window manager (shown in Figure 5.25), comes with the XFree86 X Window distribution. Installed under the /usr/X11R6/bin directory, this window manager provides the basics of window management for X:

05fig25.jpg

Figure 5.25 The twm provides basic window operations for your X sessions.

You'll find twm's system-wide configuration file, system.twmrc, under the /etc/X11/twm directory. This file contains default definitions you can change and use for yourself. Copy system.twmrc to your home directory as .twmrc to make your changes. You can use twm by inserting the twm command in your .xinitrc file.

twm's default startup file, which defines twm's root menu (accessed by pressing the left mouse button in a blank area of the desktop) now includes a menu item definition for a terminal. You'll certainly want to customize this menu to add other clients. Before using twm, open your copy of .twmrc in your favorite text editor, such as pico (the -w option disables line wrapping):


   # pico -w .twmrc

Look for the section defining the root menu:

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
"Xterm"         f.exec "exec xterm &"
"------------"  f.nop
"Kill"          f.destroy
"Delete"        f.delete
"------------"  f.nop
"Restart"       f.restart
"Exit"          f.quit
}

This section of .twmrc contains root menu labels, followed by an appropriate command for the twm window manager. For example, to "kill" a window, you press your left mouse button on the desktop, drag down to select the Kill menu item, and then press your mouse button over the top of a desired window—twm then removes the selected window. Now insert a menu definition to create and display a calendar of the current month, like this:

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
"Xterm"         f.exec "exec xterm &"
"Calendar"      f.exec "cal | xmessage -file - &"
"------------"  f.nop
"Kill"          f.destroy
"Delete"        f.delete
"------------"  f.nop
"Restart"       f.restart
"Exit"          f.quit
}

The example menu item uses the cal command to pipe its output into the xmessage client for display, resulting in a small floating-window calendar for the desktop. After making your changes, save the new .twmrc file. If you're running twm, press your left mouse button and drag down to select the Restart menu item (which restarts twm) using the newly defined menu. This is how you can customize not only twm, but also the fvwm2 window manager discussed in this chapter.

Share ThisShare This

Informit Network