Tải bản đầy đủ - 0 (trang)
An Alternative Window Manager: fvwm2 (Linux in a Nutshell, 3rd Edition)

An Alternative Window Manager: fvwm2 (Linux in a Nutshell, 3rd Edition)

Tải bản đầy đủ - 0trang

An Alternative Window Manager: fvwm2 (Linux in a Nutshell, 3rd Edition)


fvwm2 is the latest generation of a window manager called fvwm, but in neither case has it

been entirely clear what fv stands for. Virtual seems a reasonable guess for the v. fvwm

predates both GNOME and KDE as a program that can provide multiple virtual screens to

expand your desktop real estate. But the meaning of the f in fvwm 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 fvwm is that your

desktop can be larger than the area of your screen. In fact, fvwm2 can let you 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-bytwo grid.

You can run applications on any of the screen pages you want and navigate the entire desktop

in a variety of ways. And if the default environment doesn't suit you, well, you can specify a

grid of any size you like. How about three screens across and two down? No problem.

And if that 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, whatever you like. fvwm2 provides the tools for you to navigate whatever space you


fvwm2 is also customizable in a vast number of other ways, some of the more significant of

which this chapter will summarize. What it all boils down to is maximum workspace and

maximum flexibility.

17.1. Running fvwm2

Most flavors of Linux will come with some reasonably current version of fvwm2. If you're

running GNOME or KDE, the easiest way to switch over to fvwm2 is to:

1. Invoke the window manager in your X client's startup file. (Depending on your

environment, this file may be called .xinitrc, .startx, .xsession, or .Xclients.)

2. Then restart X.

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





-geometry +50+0 &

-geometry -0+0&


-title login -iconic

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_01.htm (2 of 3) [15/05/2002 18:13:30]

An Alternative Window Manager: fvwm2 (Linux in a Nutshell, 3rd Edition)

Although hypothetically you can run fvwm2 along with GNOME or KDE, they provide

greatly overlapping functionality. What you get is an ugly hybrid and not fvwm at all.

16.3. The KDE Control


17.2. Configuration Files

Copyright © 2001 O'Reilly & QKFIN. All rights reserved.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_01.htm (3 of 3) [15/05/2002 18:13:30]

Configuration Files (Linux in a Nutshell, 3rd Edition)

Linux in a Nutshell, 3rd


17.2. 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


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 edit your .fvwm2rc file to

adapt the window manager to your needs.

There are a few simple rules in editing your .fvwm2rc file. First, any line that begins with a

pound sign (#) is a comment (i.e., it 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. The section "Making the FvwmWinList Part of Your Default

Environment," later in this chapter, illustrates the use of this syntax. The final thing to keep in

mind is that it will make life 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 of the configuration options and illustrates their use; you may

also want to consult the manpages for the so-called fvwm2 modules, introduced in the next

section. The web site http://www.fvwm.org is the definitive source for window manager

documentation, news, source code, and updates.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_02.htm (1 of 2) [15/05/2002 18:13:33]

Configuration Files (Linux in a Nutshell, 3rd Edition)

This chapter should help you cut to the chase in performing some of the more basic and useful

customizations, as well as some tricky but handy upgrades.

17. An Alternative Window

Manager: fvwm2

17.3. A Modular Approach

Copyright © 2001 O'Reilly & QKFIN. All rights reserved.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_02.htm (2 of 2) [15/05/2002 18:13:33]

A Modular Approach (Linux in a Nutshell, 3rd Edition)

Linux in a Nutshell, 3rd


17.3. A Modular Approach

fvwm2 has been designed to allow the interested programmer or programmer wanna-be to

devise new components, known to insiders 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 environment.

The FvwmWinList is another useful module. Though not as ubiquitous as the Pager, it is just

as useful. The FvwmWinList 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 to switch the screen view so that

you can use that application. 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. Many 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 process;

you cannot start one from the command line. Note 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.

17.2. Configuration Files

17.4. How to Implement

Window Manager


Copyright © 2001 O'Reilly & QKFIN. All rights reserved.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_03.htm [15/05/2002 18:13:36]

How to Implement Window Manager Customizations (Linux in a Nutshell, 3rd Edition)

Linux in a Nutshell, 3rd


17.4. How to Implement Window Manager


If you edit your .fvwm2rc file, simply restart fvwm2 to have the changes implemented. In

most environments, there will be a menu item that restarts the window manager. The vanilla

setup we started with offers the item Exit fvwm2 on the Root menu. If you select that item,

you'll get a submenu titled Really quit fvwm? and several items including Restart fvwm2.

When you select Restart fvwm2, your configuration changes should be implemented. A

slower but just as effective way is to quit the X session and start it again (presuming your

session startup file includes fvwm2).

17.3. A Modular Approach

17.5. A Quick Tour of the

fvwm Environment

Copyright © 2001 O'Reilly & QKFIN. All rights reserved.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_04.htm [15/05/2002 18:13:38]

A Quick Tour of the fvwm Environment (Linux in a Nutshell, 3rd Edition)

Linux in a Nutshell, 3rd


17.5. A Quick Tour of the fvwm Environment

In any desktop environment with multiple virtual screens/pages, you can work on only a

single screenful at a time. But fvwm2 makes it easy to switch the view between pages, run

applications on different pages, and move applications between them. If you refer to a

particular window all the time, you can even arrange for it to appear on every page of every

desktop. (We'll come back to this concept of "sticky" windows.) And you're not limited to

viewing a page proper or keeping a window entirely on a single page.

Notice the long horizontal box in the bottom right corner of our sample environment (Figure

17-1). This box is the FvwmButtons module (also called the button bar). FvwmButtons is

generally used to house a number of tools and applications to which the user needs frequent

access. Often these are other fvwm modules.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_05.htm (1 of 3) [15/05/2002 18:13:42]

A Quick Tour of the fvwm Environment (Linux in a Nutshell, 3rd Edition)

Figure 17-1. A typical fvwm2 environment

In our sample configuration, FvwmButtons contains two other modules: the Icon Manager

(FvwmIconMan) on the left side of the box and to its right, the Pager (FvwmPager). At the far

right of FvwmButtons you'll also see three small application windows: xbiff (a mailbox that

indicates when you have new messages), xclock, and xload (a graphic representation of your

system's workload).

The Icon Manager and the Pager are tools that let you both monitor what's happening in your

environment and manipulate the windows running there. The Icon Manager shows an entry

for every conventional window currently on your display. If that window is iconified, the Icon

Manager entry is preceded by a square that has a three-dimensional appearance. You can

iconify and deiconify any window on the current page by clicking the first pointer button on

the corresponding entry in the Icon Manager. (The Icon Manager always shows the windows

on the current page; for a similar tool that reflects what's running on every page on every

desktop, check out the FvwmWinList, described later in this chapter.)

Think of the Pager as a tiny mirror of your entire desktop(s). In a typical default environment

of a single desktop composed of two-by-two screen pages, the Pager shows a small grid of

four partitions separated by dotted lines. These partitions correspond to the desktop's four

virtual screen pages. (If you configure for multiple desktops, a solid line is used to show the

border between desktops. The section "Having Multiple Desktops," later in this chapter, tells

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_05.htm (2 of 3) [15/05/2002 18:13:42]

A Quick Tour of the fvwm Environment (Linux in a Nutshell, 3rd Edition)

you how to set this up.)

Each application you run appears in miniature in the Pager window. Applications with small

windows are fairly hard to spot in miniature, but a blip representing them is there if you look

closely. The miniature version of a larger client, like xterm, should have a readable label.

Whatever operations you perform on windows on the desktop -- e.g., move, iconify, resize,

and so on -- are mirrored in the Pager. But the Pager is more than a monitor of activity; it's

also a tool. Thus, you can move the miniature versions, and the actual windows will be

moved. The Pager can also help you move windows between pages and desktops and select

the area to be displayed on your monitor (which does not have to correspond to a page


In addition to the desktop tools, fvwm2 is commonly configured to provide a slew of

cascading menus beginning with the Root menu. Clicking the first pointer button on the root

window should reveal this menu. The Root menu is usually a good way to start a new terminal

emulator window. If you start with the default environment for your system, the Root menu is

likely to have submenus like Fvwm Modules, Fvwm Window Ops (which offers items like

moving, resizing, and closing windows), Fvwm Simple Config Ops (for changing focus

policies, how paging works, etc.), and Exit Fvwm (for restarting or exiting the window

manager, starting another one, etc.).

This chapter assumes you know how to perform basic window manager operations. We're not

going to teach you how to use the Pager or all the menu items. But we will show you how to

change the number of desktops the Pager shows, add menu items, configure keyboard

shortcuts, and make useful customizations.

17.4. How to Implement

Window Manager


17.6. Specifying Click-toType Focus

Copyright © 2001 O'Reilly & QKFIN. All rights reserved.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_05.htm (3 of 3) [15/05/2002 18:13:42]

Specifying Click-to-Type Focus (Linux in a Nutshell, 3rd Edition)

Linux in a Nutshell, 3rd


17.6. Specifying Click-to-Type Focus

Most versions of fvwm2 are configured to use the pointer focus model (FocusFollowsMouse or MouseFocus in

the configuration file). This means you need to move the pointer into a window in order to type in it, post an

application menu, and so forth. However, fvwm2 is somewhat more versatile than other window managers in

this regard.

There are two other focus policies available: click-to-type focus (ClickToFocus), which requires you to click

the pointer on the window in order to type in it, and the very handy SloppyFocus, which is like pointer focus

with a twist -- the focus does not leave the last window that had it until you move it into another window that

takes over the focus. This can come in handy, particularly with terminal emulator windows like xterm and

rxvt. You can actually move the pointer out of the way -- accidentally or on purpose -- and still continue to

type in the window.

The best part of fvwm2's way of handling focus policy is that you can mix and match what windows use what

type of focus. All of the settings for focus policy are used as arguments to the Style variable. (Style takes

several arguments that determine the appearance and behavior of a particular client or window manager


In the following excerpt from a configuration file, the first line makes pointer focus the default for all

applications (the asterisk is a wildcard). The subsequent lines specify the exceptions to this rule. The button bar

works better with click-to-type focus, as do xman (the manpage viewer) and xmag (a magnification tool). The

two terminal emulators benefit from sloppy focus.














Icon toolbox.xpm, ClickToFocus

Icon xman.xpm, RandomPlacement, ClickToFocus

Icon mag_glass.xpm, RandomPlacement, ClickToFocus

Icon xterm.xpm, SloppyFocus, IconBox -70 1 -1 -140

Icon term.xpm, SloppyFocus, IconBox -70 1 -1 -140

(See Style on the fvwm2 manpage for more information about this versatile option.)

In our sample configuration, the Simple Config Ops submenu of the Root menu offers three items that let you

change the focus policy on the fly, just for the current window manager session:

Sloppy Focus

Click to Focus

Focus Follows Mouse

Note, however, that these items supersede what's in your configuration file for all applications. If you want to

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_06.htm (1 of 2) [15/05/2002 18:13:44]

Specifying Click-to-Type Focus (Linux in a Nutshell, 3rd Edition)

recover the more specialized definitions in your configuration file, you'll have to restart the window manager.

17.5. A Quick Tour of the

fvwm Environment

17.7. Raising the Focus

Window Automatically

Copyright © 2001 O'Reilly & QKFIN. All rights reserved.

file:///E|/O'Reilly/O'Reilly%20-%20Linux%20in%20a%20Nutshell,%203rd%20Edition/Pages/ch17_06.htm (2 of 2) [15/05/2002 18:13:44]

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

An Alternative Window Manager: fvwm2 (Linux in a Nutshell, 3rd Edition)

Tải bản đầy đủ ngay(0 tr)