Next Previous Contents

6. Configuring the Window Manager

Now we take a look at the files to configure your window manager. These vary from manager to manager, but for our examples we will focus on the per-user files, and we are looking at FVWM2 in this example, so you will modify the file .fvwm2rc in your home directory.

6.1 Basic FVWM2 Configuration

Configuring your window manager resource file in earlier versions of FVWM was a rather arduous process, because the order of the items in the file needed to be very particular, but that has relaxed quite a bit in this version. To my knowledge, the only crucial part of the ordering is the bindings for the menus, but we'll cover that a bit later. Your FVWM2 installation should have come with an example resource file, and you should be able to find that in /var/X11R6/lib/fvwm2/system.fvwm2rc. This is the default system-wide configuration file. A good idea would be to copy that file into your home directory and call it .fvwm2rc. From that point on, when FVWM2 starts up it will read the file in your home directory, and ignore the system-wide configuration file.

Now that you've got a working, personalized copy of the window manager resource file in your home directory, open it in your favorite text editor, and take a look at it. If you're in X at the moment, you can see the correlation between the file and what you see on your desktop. Very helpful indeed. Let's try changing something and see if we can make it look a little better. Probably the first entry in your file (that is not followed by the # comment character) is the WindowFont entry, followed by a very bizarre font name. If you want to figure out how to set up the fonts and colors to their fullest, skip ahead to the next section on X Fonts and Colors.

6.2 Advanced FVWM2 Configuration

Configuring FVWM2 can get incredibly subtle and complex. Take this code snippet from the fvwm2gnome setup for the .fvwm2rc file:


 # import config files
 
 Echo -Styles- 
 Read .fvwm2gnome/config/styles/app.styles
 Read .fvwm2gnome/config/styles/window.styles
 
 Echo -Buttons & Keys-
 Read .fvwm2gnome/config/buttons.config
 

This is an example of a way to read in other configurations. In this fashion you can modularize your .fvwm2rc -- not a bad idea, considering how jumbled one huge configuration file can become. This can make it easier to change and to debug, and it also makes it easier to configure so-called themes, which we will cover in a moment.

6.3 FVWM2 Configuration Shortcuts

A really neat way to configure your script for FVWM2 (and FVWM, and bash, and a whole lot of other programs besides!) is to use the Dotfile Generator, by Jesper K. Pedersen, available from http://www.imada.ou.dk/~blackie/dotfile/. You will need to have a recent version of Tcl/Tk installed (available with most Linux distributions). This program starts with a configuration preset, or takes the one you presently have, and allows you to tweak it via many structured menus of options.

Be warned, however, for I advise learning how to set up your configuration file yourself! Not only is this the Unix Way (for what that's worth) but it's much easier to make small and incremental changes to your .fvwm2rc file that way, and get things exactly how you like them. Also, being a Tcl/Tk program, it's a little slow. Nevertheless, if you want a painless way to start with a decent configuration, this is definitely worth a shot.

6.4 FVWM2 Themes

Among the many new possibilities of FVWM2 are something commonly called themes. This basically means that you can switch between a basic look for all of your windows on your desktop, on the fly. Note that if you've made the distinction between the functions of the window manager and the functions of the applications themselves, you will realize that a window manager theme is not going to affect the look and feel of the applications themselves. Integrated toolkits such as KDE and GNOME do have this capability, however, and the two might be used together very effectively.

In order to generate a theme, you must roll up your sleeves and modify your .fvwm2rc file a little bit. Here's something I added near the beginning of my file, try putting it right after your Style definitions:


 # Blue Theme
 DestroyDecor Blue
 AddToDecor Blue
 + WindowFont -b&h-lucida-bold-r-*-*-*-140-*-*-*-*-*-*
 + TitleStyle ActiveDown (Solid DarkSteelBlue)\
     ActiveUp (Solid SteelBlue) Inactive (Solid Grey)
 + HilightColor white blue
 + ButtonStyle 1 -- UseBorderStyle
 Style Blue UseDecor Blue, BorderWidth 5, HandleWidth 5,\
     MWMborder, MWMbuttons
 
 # Function to change all windows to a new style.
 DestroyFunc ChangeStyle
 AddToFunc ChangeStyle
 + "I" Style $0 $1
 + "I" Recapture
 

That's a lot to swallow, I know. Basically we're first defining a theme called ``Blue,'' and you can use that first half as a model to design other themes. Themes can describe many more features than that, in fact, and can be quite remarkably different from one another. Then we're defining a function to change all the windows to a new style. Notice in both sections above that we destroy the object before creating it. This is a good idea since you may well be restarting FVWM2 a lot to try out your different styles, and this makes it work a bit more smoothly.

The function call is needed as a generic interface to call the definitions of the styles we have defined. Now we will make the menu items to call them.


 DestroyMenu "Themes"
 AddToMenu "Themes"
 + "Choose a theme..." Title
 + "" Nop
 + "Blue" ChangeStyle "*" "UseStyle Blue"
 + "Mwm" ChangeStyle "*" "UseStyle Mwm"
 + "Flat" ChangeStyle "*" "UseStyle Flat"
 

We're being a little terse with the menu definition here, but there should be a lot more in the sample file on your system. What we're doing is calling the ChangeStyle function that we defined above to change the style for all the windows on the screen to one of the presets we defined above that. Notice, again, our good practice in destroying the menu before creating it. Now if you restart FVWM2 (you should also have a menu option for that, hopefully!) you will see a new Themes menu selection, and you should be able to try out the different themes.

For more examples of FVWM2 Themes, visit http://www.vis.colostate.edu/~scriven/Linux/fvwm/index.html.


Next Previous Contents