home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeLinux in a NutshellSearch this book

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 component.)

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.

Style "*"           FocusFollowsMouse
Style "FvwmButtons" Icon toolbox.xpm, ClickToFocus
Style "xman"        Icon xman.xpm, RandomPlacement, ClickToFocus
Style "xmag"        Icon mag_glass.xpm, RandomPlacement, ClickToFocus
Style "XTerm"       Icon xterm.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt"        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 recover the more specialized definitions in your configuration file, you'll have to restart the window manager.



Library Navigation Links

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