Linux in a NutshellLinux in a NutshellSearch this book

Chapter 19. An Alternative Window Manager: fvwm2

Contents:

Running fvwm2
Implementing Window Manager Customizations
Adding Keyboard Shortcuts
Customizing Menus
The WinList: Switching the Focus

Among the most appealing characteristics of a Linux system are its flexibility, its independence from industry-dominating standards, and the degree of control a user has over his own working environment. Most flavors of Linux come with a default desktop environment replete with handy tools and menus and a consistent look and feel. The most widely used of these desktop environments are GNOME and KDE, the customization of which are detailed in Chapter 17 and Chapter 18, respectively. Both of these environments put a PC-like wrapper around what is basically a no-frills Unix-based system suitable for personal computers. For some people this is a good thing. But if you want a basic, functional desktop, and you're comfortable editing configuration files to customize your environment, you might instead try the fvwm2 window manager.

fvwm2 is the latest generation of a window manager called fvwm. fvwm predates both GNOME and KDE as a program that can provide multiple virtual screens to expand your desktop real estate. The letters vwm stand for virtual window manager, but the original meaning of the f has been forgotten and has led to much speculation. In fact, among the latest group of the program's developers are a number of cat lovers who claim the f stands for feline.

The first important concept you should understand in order to work with fvwm2 is that your desktop can be larger than the area of your screen. In fact, fvwm2 allows you to have acres of desktop real estate in the form of virtual screens, or pages. In a typical default environment, you might have a single desktop composed of four virtual screens/pages arranged in a two-by-two grid.

You can run applications on any of the screen pages you want and navigate the entire desktop in a variety of ways. If the default environment doesn't suit you, you can specify a grid of any size you like. How about three screens across and two down? No problem.

And if that still isn't enough space for you, you can also have multiple desktops, each composed of multiple pages. You might use separate desktops for different applications or different projects. fvwm2 provides the tools to navigate whatever space you design.

fvwm2 is also customizable in a vast number of other ways; the most significant are summarized in this chapter. What it all boils down to is maximum workspace and maximum flexibility.

19.1. Running fvwm2

Your Linux distribution may include a reasonably current version of fvwm2; if not, you can download it from http://www.fvwm.org. If you're running GNOME or KDE, the easiest way to switch over to fvwm2 is to edit your X client's startup file to invoke the window manager and then restart X. If you start X from the Linux command line with the startx command, the startup file is .xinitrc; if you start X from one of the graphical display managers (XDM, GDM, or KDM) and you are running Red Hat Linux, the file is probably .Xclients; otherwise, it is .xsession.

Here is an excerpt from a simple startup file that has been edited to run fvwm2:

xterm -geometry +50+0 &
xterm -geometry -0+0&
exec fvwm2

fvwm2 provides GNOME support as a compile-time option. As this is being written, the current stable version of fvwm2 is 2.4.15. The next major release, currently in development as the 2.5 series, will also support KDE compliance. In addition, fvwm2 now supports Xinerama as a compile-time option. Xinerama is a feature of recent versions of XFree86 that permits multiple monitors to be treated logically as a single monitor (of course, each of these monitors needs its own video card).

19.1.1. Configuration Files

The key to how fvwm2 works is the configuration file it reads at startup or restart. The systemwide configuration file is called system.fvwm2rc and usually lives in the directory /etc/X11/fvwm2. The typical system.fvwm2rc file that gets distributed should create a simple but perfectly workable environment. We'll take a look at one in the next section. There's no guarantee that the file on your system will create the same layout, but you'll get the idea.

If you want to customize fvwm2 to suit your needs, you need to make a copy of system.fvwm2rc called .fvwm2rc and put it in your home directory. This personal configuration file takes precedence over the systemwide file. You can edit your .fvwm2rc file to adapt the window manager to your needs.

There are a few simple rules for editing your .fvwm2rc file. First, any line that begins with a pound sign (#) is a comment (i.e., is not interpreted as part of the window manager definition). Second, a plus sign (+) at the beginning of a line means to repeat the first terms from the previous line. Section 19.5.2, later in this chapter, illustrates the use of this syntax. The final thing to keep in mind is that life will be simpler if you weave your own definitions into the file, respecting its current contents and their order. So, for instance, if you decide to define some function keys, put your new lines in the section of the file that already deals with keys.

In terms of fvwm2 customization, there's some good news and some bad news. The good news is that you can make an extraordinary number of changes to the way fvwm2 looks and operates. That's also the bad news. The window manager has dozens of configuration options, many very handy and easy to use, others complex and even arcane. The sum total can make the configuration file syntax daunting to anyone who isn't accustomed to serious tinkering. In fact, you could get dizzy considering the possibilities.

The fvwm2 manpage gives all the configuration options and illustrates their use; you may also want to consult the manpages for the fvwm2 modules, introduced in the next section. The web site http://www.fvwm.org is the definitive source for fvwm2 documentation, news, source code, and updates.

This chapter will help you cut to the chase in performing some of the more basic and useful customizations, as well as some tricky but handy upgrades.

19.1.2. A Modular Approach

fvwm2 has been designed to allow the interested user to devise new components, known as modules. A typical module is the Pager (FvwmPager), which provides a map of the desktop space and a way to navigate it, as we'll see a little later in the chapter. The Pager is a default module in just about any desktop environment.

FvwmWinList is another useful module. Though not as ubiquitous as the Pager, it is just as useful. The module displays the WinList, which is a small window that provides a list of all the windows running on all pages of all desktops. The WinList is another navigation tool, allowing you to switch the pointer focus to any application you have running and switch the screen view so that you can use that application. We'll talk more about this later.

A module is actually a separate program from fvwm2 but works in concert with it, passing commands to be executed to the window manager. Most configurations of fvwm2 have a Root menu with an FvwmModules submenu from which you can start certain of these programs. (Naturally, the list of modules on the menu is configurable.) You might also edit your .fvwm2rc file to run modules in other ways (when you type certain keys, when other events happen, etc.).

Since a module is a separate program, users can write their own modules without adversely affecting fvwm2. Note, however, that you must configure fvwm2 to start the module's process; you cannot start a module from the command line. Note also that while some modules, like the Pager, are intended to be used for the entire session, others simply perform a function and exit (e.g., RefreshWindow). Since modules are programs in their own right, many of them have their own manpages too.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.