View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > FVWM

From LQWiki

Jump to: navigation, search

Introduction

"FVWM is an extremely powerful ICCCM-compliant multiple virtual desktop window manager for the X Window System."

Created around 1993 by Robert Nation, FVWM is based on twm, but has almost no code relating to it now, whatsoever. FVWM has helped spawn a number of other window managers, some of which include: ctwm, vtwm, and even Enlightenment. It is currently maintained by the people on the fvwm-workers mailing list.

FVWM is extremely configurable, and is extensible with "modules" that keep the base code clean and relatively lightweight. (fvwm may use about 5 megs of virtual memory, only half of that resident - less than xterm and only a little more than mc, bash, etc.) The modules include pagers, taskbars, the remarkable FvwmButtons, and many more.

FVWM, with no configuration, is extremely ugly and, with default configuration, is even uglier. However, it can be transformed into one of the most attractive window managers around.

The man page is 8486 lines long (as of version 2.5.14) and this is only one of dozens of manuals, as the others cover the various modules and the main man page only covers the core fvwm. The syntax can be rather baroque, as well. To compensate for this, a cottage industry of dotfiles has arisen and even a full fvwm-themes package which attempts to provide a more suitable default configuration and to permit easier customization. If you're looking for a window manager that requires no effort or fuss, fvwm is probably not for you. However, if you're willing to invest some time and effort achieving the perfect window manager, it's not that hard and fvwm can probably do what you want done.

Configuration

As a crash course summary in hand-configuration, the main configuration file has gone in a few places under a few names, but creating an ~/.fvwm/config seems to be the current best practice. For a simple configuration, or if you just prefer it that way, you can put all your configuration in this file. If you'd rather break it apart for organizational or size purposes, you can do so, and simply use the 'Read' command in the main config file to read in the auxilary files at the appropriate point. See: http://fvwmwiki.bu-web.de/FvwmFileStructure and http://fvwmwiki.bu-web.de/GeneralConfigGuideLines)

The main things are to set the environment variables you will reuse in your configuration with the 'SetEnv' command (caveat emptor, this is by no means true at all, see: http://fvwm.lair.be/viewtopic.php?t=1505). You can define colors with the newer 'Colorset' command or still style individual elements with their various color specifications. There are a host of miscellaneous specifications such as 'DefaultFont' and 'DefaultColorset' and 'DesktopName's and so on. The essential thing to grasp is that most everything you want to do is done through styles. Here again, there are miscellaneous styles, but several clusters of styles - for instance, with 'FocusStyle', you don't have to choose between a simple 'click to focus' or 'sloppy focus' sort of model, but can precisely specify your focus style. Individual applications are styled with their app styles - while generic styles take the form of 'Style * [value]', applications can be styled with 'Style [AppName] [value]. So if you want an application like gkrellm handled specially, 'Style gkrellm [special handling]' is the way to do that. Akin to the precision with which you can specify the focus model, you can also build up complex functions out of more basic primitives: defining a Start and ExitFunction will control what fvwm does on those occasions and it even verges on a scripting language in that you can apply these conditionally. Let's say you want something done at fvwm startup but not done if you restart fvwm: as part of the function definition, '+I Test (Init) [action]' will make sure it only happens at a true start and not a restart. Extending the scripting concept, the powerful 'Piperead' command can actually read output from the shell or shell scripts, speaking to the fvwm command interpreter (which can also be accessed interactively with the FvwmConsole module). As an example, from the FVWM FAQ (www.fvwm.org):

DestroyFunc CenterWindow
AddToFunc   CenterWindow
+ I ThisWindow Piperead "echo Move \
    $(( $[vp.width]/2-$[w.width]/2 ))p \
    $(( $[vp.height]/2-$[w.height]/2 ))p"

Note thought that using such a function in FVWM 2.5.X is obsolete, in favour of either 'CenterPlacement' style, or the very recent 'PositionPlacement Center' style.

This underscores an important element of fvwm: it's a window manager construction kit. Some window managers will do this function automatically with a builtin. In fvwm, you construct it yourself. But if another window manager doesn't have another function you want, you will have to hack it or do without. With fvwm, just as you can create a 'CenterWindow' function, you can create almost anything else you want.

Having set up your environment and your styles and your functions, it's just a case of binding them to mouse buttons with the 'mouse' command or to keys with the 'key' command, or assigning them to menus. Menus are built in a fashion similar to functions in the sense that you can 'DestroyMenu' and then 'AddToMenu' and then the items accumulate. The nice thing about this is that you can define several separate menus and then bind them separately or combine them into other menus. This means less redundant specification, more flexibility, and an actual enhancement in ease of use.

If you've seen the Windows or KDE cascading menus of your filesystem, this can be accomplished with fvwm by extending the scriptability still further. Fvwm comes with an 'fvwm-menu-directory' script which is written in perl. It can be assigned to a function with

DestroyFunc FuncFvwmMenuDirectory
AddToFunc FuncFvwmMenuDirectory
+ I PipeRead "fvwm-menu-directory \
    --check-subdirs --links --exec-file sak --dir '$0'"

and then bound to a menu with

DestroyMenu BrowseMenu
AddToMenu BrowseMenu MissingSubmenuFunction FuncFvwmMenuDirectory
+ "&Home" Popup $[HOME]
+ "&Root" Popup /
+ "&Packages" Popup /var/log/packages

Voila! cascading menus of the filesystem. The perl script basically only handles text files but, with the '--exec-file' option, you can plug in your own script (which may be a Swiss Army Knife of a file opener written in shell) which checks filetypes, defines handlers, and can handle most any filetype with most any application. Again, this is perhaps not something vital, but illustrates fvwm's power and extensibility and how it can work by reusing parts and communicating with diverse subcomponents in a genuine Unixy way. Some window managers may have this capability, but it seems kind of tacked onto the menu structure and doesn't pervade the program philosophy. (As a sidenote, the MenuStyle command is another cluster of the styling mentioned above and you can define your menus in excruciating detail, down to the pixel.)

Lastly (for a basic run through), each module, as mentioned, comes with its own man page and its own commands and styles.

External links:


Personal tools