Your choice of window manager determines, to a large extent, the look and feel of your X environment. Many window managers also provide menus, which allow you to start other X applications using the mouse, and a virtual desktop, which increases your overall desktop space considerably.
fvwm is a virtual desktop window manager used by many Linux users. It is based partially on the code for twm, a classic window manager included with the MIT X11 distribution. However, fvwm has been trimmed down and requires about half the memory used by twm--welcome news for Linux systems with 8 MB or less of physical RAM. fvwm provides many features not available in other window managers, and for this reason (as well as the fact it was developed specifically for Linux), we are covering it here.
Unlike twm and some other window managers, fvwm undergoes constant development. This means that some of the features described here may not be present in the same form in newer versions of the software. Refer to the manual page for fvwm to verify that the features presented here are available. We will cover Version 2 of fvwm here.
Among the features offered by fvwm are:
A simple virtual desktop, which provides a pager (an overall birds-eye view of the desktop) and automatic desktop scrolling when the pointer reaches the screen boundary.
A keyboard equivalent for almost every mouse-based feature; this is helpful when using X on laptops without a mouse or trackball, or for people with RSI or other physical problems making use of the mouse difficult.
Support for color icons using the XPM libraries.
A programming interface for extensions, allowing you to add new features to fvwm. One extension included in the fvwm distribution is a button box that stays put on your root window. You can bind commands to each button, allowing you to point and click to start applications.
Fully configurable desktop menus, which appear when you press the mouse buttons.
A Motif-like 3D look and feel for window frames. In fact, fvwm includes options to make it compatible with the Motif window manager (mwm).
Among the most powerful fvwm features is the virtual desktop, which allows you to place windows on an area much larger than the actual size of the visible display. Using the mouse, you can switch (page) between areas of the virtual desktop. For example, when you move the mouse pointer to the right edge of the display, the desktop will shift a screen to the left, bringing new windows into view. This way you can place windows across an area larger than your screen, viewing only a portion of the virtual desktop at one time.
A sample desktop using fvwm was shown in Figure 11-1 in the section "Section 11.1.1, "xinit"." Each window is given a decorative frame, provided by fvwm, with configurable titlebar buttons. Later in this section, we'll describe how to customize these to your liking.
The pager, in the top-right corner of the display, gives a bird's-eye view of the entire virtual desktop. The pager can also move windows around the virtual desktop and select the portion of the desktop currently in view.
In order to customize fvwm, you'll need to create a configuration file, .fvwm2rc, in your home directory. In this section, we're going to present a number of features of fvwm and describe how to enable them from .fvwm2rc.
We must warn you that the syntax of some of the options has changed between different versions of fvwm; check them against the manual page if you have problems. You may wish to use the system default .fvwm2rc file (usually found in /usr/lib/X11/fvwm2/system.fvwmrc) as a starting point.
# Set up colors Style "*" Color White/Midnightblue HilightColor White Red WindowFont -adobe-helvetica-bold-r-normal-*-*-120-*
Some commands depend on which window has the focus, which means that it is receiving input. (Normally you just click with the mouse in a window to make it the one in focus.) Unfocused windows, menus, and the pager use the color that has been set with Style "*" Color, while the window with the focus uses the color that was set with HilightColor. The foreground color is generally used for text (in the window title, and so forth) and the background is used for the window frame itself. Be artistic! WindowFont names the font used by window titlebars. Note that none of these options sets the colors used inside windows, because these are controlled by the application (client). The options apply only to window frames and menus, because those are managed by fvwm.
To get a list of all the colors defined on your system, enter the command:
eggplant$ showrgb | more
Most fvwm users also make use of the virtual desktop. In order to configure it, you should include lines such as the following in .fvwm2rc:
We want the size of the desktop (DeskTopSize) to be three screens wide by three screens high. The line starting with AddToFunc says that when starting fvwm, the pager should be started, too. The Style line determines that the pager is to be shown in each virtual desktop (Sticky), that it should not have a window titlebar (NoTitle), and that it should not be shown in the window list (WindowListSkip). In addition, we place the pager in the bottom right corner of the screen. The pager window provides a view onto the full virtual desktop; clicking with the mouse in the pager window makes the corresponding part of the desktop visible on the screen. In Version 1 of fvwm, the pager was a fixed part of the window manager, but Version 2 makes the pager a module of its own. That's also why the pager is no longer configured via fvwm options like Pager as in earlier versions, but via the settings for the module FvwmPager. A module is an add-on to the window manager that cannot run standalone. Frequently used modules, like the pager, are shipped with fvwm2.# Configure virtual desktop DeskTopSize 3x3 AddToFunc InitFunction "I" Module FvwmPager 0 0 Style "FvwmPager" Sticky, NoTitle, WindowListSkip *FvwmPagerGeometry -10 -10 EdgeScroll 100 100
EdgeScroll specifies the percentage by which the desktop should scroll when the pointer reaches the edge of the screen. Using EdgeScroll 100 100 causes the desktop to shift by an entire screen when we move the mouse cursor to the edge; this gives the appearance of switching from one screen to an entirely different one. This way you can place windows across the entire virtual desktop and wander around the desktop using only the mouse.
The Style command sets a whole slew of attributes for windows on your screen. For instance, to specify that the xbiff always stays on top of other windows on the display, use the command:
Style "XBiff" StaysOnTop
Now, no other window is allowed to obscure xbiff. Besides StaysOnTop, other popular options to Style include:
Prevents a window from having a decorative title on the top with its name. This option is often used for small windows like xclock and xbiff, especially if you don't expect to move or resize them.
Prevents a window from having a border.
Makes a window stay in the same place on the screen when you shift the virtual desktop.
Sets the width in pixels of frames placed around windows by fvwm. The default used by fvwm is six pixels, which is quite wide.
Arguments to Style may be window titles or application-class names. Older versions of fvwm don't have the Style command. Instead, they offer a variety of commands named StaysOnTop, NoTitle, and so on. You use them like this:
There are various .fvwm2rc commands dealing with icons. As with other window managers, fvwm allows you to iconify a window; this replaces the window with a small icon containing the name of the window and possibly a picture depicting the type of window. fvwm supports both bitmaps and color pixmaps for icons. A bitmap allows only one bit for each pixel it displays and therefore is limited to one background and one foreground color (although you can get a mixture or gray by alternating pixels, a process called dithering). A pixmap, on the other hand, has several bits per pixel and can therefore support a large number of colors:
IconFont specifies the font to use for icons. IconPath and PixmapPath specify colon-separated pathnames where icon images can be found; if you keep images in several directories, separate their pathnames with colons. IconPath specifies locations for bitmaps (XBM), and PixmapPath specifies locations for color pixmaps (XPM).IconFont -adobe-helvetica-medium-r-*-*-*-120-* IconPath /usr/include/X11/bitmaps/:/usr/include/X11/xfm/bitmaps PixmapPath /usr/include/X11/pixmaps/:/usr/include/X11/xfm/pixmaps Style IconBox 700 0 1080 50 Style "*" Icon unknown.xpm Style "XTerm" Icon xterm.xpm Style "Emacs" Icon emacs.xpm
Style IconBox defines a region of the screen where icons should be placed. You can specify more than one IconBox: up to four, if you wish. In this case, icons should be placed in an invisible box defined by the top-left corner at location (700,0) and bottom-right corner at (1080,50).
Following Style IconBox are several Style commands that bind icon images to windows. In this case, we want all XTerm windows to use xterm.xpm, and Emacs to use emacs.xpm. The name of the icon file can either be a full pathname, or a pathname relative to either IconPath or PixmapPath. The command:
Style "*" Icon unknown.xpm
sets the default icon to unknown.xpm.
If your fvwm does not support the Style command, use commands such as:
Icon "" unknown.xpm Icon "XTerm" xterm.xpm Icon "Emacs" emacs.xpm
Most fvwm users include at least the previous options in the .fvwm2rc file. However, fvwm also provides the ability to configure the desktop menus, functions executed by the window titlebar buttons, and so on. Here, we'll introduce several of those features.
First, let's configure fvwm pop-up menus, which appear when pressing the mouse buttons on the root window. You can use these menus to execute commands, manipulate windows, and so on. Note that some distributions, like Debian and SuSE, can automatically update your window manager menus with the installed packages on the system:
The menu is defined with the command AddToMenu. There is no command for terminating a menu definition; the menu entries do not even have to be on subsequent lines. Each menu gets a name with which it can be referenced later (in this case xclients).AddToMenu xclients "Xclients" Title + "Netscape" Exec netscape + "xterm" Exec xterm + "emacs" Exec emacs -w + "" Nop + "eggplant" Exec xterm -e rlogin eggplant & + "papaya" Exec xterm -e rlogin papaya & + "" Nop + "screensaver" Exec xscreensaver-command -activate & + "xcalc" Exec xcalc & + "xman" Exec xman & + "xlock" Exec xlock -mode rotor & EndPopup
The format of the menu is relatively self-explanatory. The title is already set in the AddToMenu line; Nop causes a separator line to appear in the menu. The Exec function causes a command to be executed when the menu item is chosen; the arguments to Exec determine which command is executed. The leftmost argument of each command line is the name of the item as it appears in the menu (such as "Netscape"); the remaining arguments specify the command to be executed.
We define a second menu, fvwm, which uses the fvwm window-manipulation functions:
Each of the built-in functions Move, Resize, Lower, and so on are described in the fvwm2 manual page. One function of note is Popup, which allows a previously defined pop-up menu to be used as a submenu of the current menu. Here, we include the xclients menu defined as a submenu.AddToMenu fvwm "Window Ops" Title + "Move Window" Move + "Resize Window" Resize + "Raise Window" Raise + "Lower Window" Lower + "Iconify Window" Iconify + "Stick Window" Stick + "" Nop + "Xclients" Popup Xclients + "" Nop + "Destroy Window" Destroy + "Delete Window" Delete + "" Nop + "Load Xdefaults" Exec xrdb -load $HOME/.Xdefaults + "Restart Fvwm" Restart fvwm2 + "Start twm" Restart twm + "Quit Fvwm" EndPopup
Also included here are commands for restarting fvwm or starting another window manager (twm) in place of fvwm.
button is 1, 2, 3, or 0 (where 0 means "any button"). context specifies the region in which the mouse binding takes effect; context may be:Mouse button context modifiers function
R for the root window
W for an application window
S for a window frame
F for a window frame corner
T for a window titlebar
I for an icon window
A digit from 0-9, specifying a particular titlebar button (described later)
A for any context (except titlebar buttons)
Any combination of these
For example, a context of TSIF specifies window titlebars, frames, and frame corners, as well as icon windows.
Using a digit from 0 through 9 in context binds the function to a window titlebar button. By default, there are two such buttons--one on the left edge of the titlebar, and one on the right. Binding mouse functions to other buttons causes them to be visible. Left titlebar buttons are given odd numbers (1, 3, 5, 7, and 9), and right titlebar buttons are given even numbers (2, 4, 6, 8, 0). Figure 11-2 shows a window with all buttons visible, with their corresponding numbers. Unless you bind mouse functions to each button, most of them will be invisible.
modifiers specifies various key combinations to be used in conjunction with a mouse-button click. Valid modifiers are C for control, M for meta, S for shift, N for none, or A for any of the above. For example, setting modifiers to C means that the Control key must be pressed while the mouse button is clicked.
Here are some examples of mouse bindings:
These lines bind each mouse button to one of the pop-up menus fvwm or xclients, defined previously, or the WindowList command, which is a pop-up menu containing entries for each window on the display:# Button Context Modifi Function Mouse 1 R N PopUp "Fvwm" Mouse 2 R N PopUp "Xclients" Mouse 3 R N WindowList
Here we bind titlebar buttons 1, 3, 4, and 2 (two buttons on each side of the titlebar) to various functions. The left-most titlebar button pops up the fvwm menu, the second-left button iconifies the window, and so on. The fvwm2 manual page lists all the available functions, such as Resize, Move, and RaiseLower.# Window titlebar buttons Mouse 1 1 N Popup "Fvwm" Mouse 1 3 N Iconify Mouse 1 4 N Destroy Mouse 1 2 N Resize
with context and modifiers having the meanings given earlier. Here are some examples:Key key context modifiers function
These bindings cause Ctrl-arrowkey to scroll the desktop by a full page in the given direction. You can bind any key to an fvwm function in this way; for instance, the function keys are named F1, F2, and so on.Key Up A C Scroll +0 -100 Key Down A C Scroll +0 +100 Key Left A C Scroll -100 0 Key Right A C Scroll +100 +0
Read the fvwm2 manual page. As new versions are released, the syntax of the configuration file changes slightly, and new features are added periodically.
Copyright © 2001 O'Reilly & Associates. All rights reserved.
|This HTML Help has been published using the chm2web software.|