Customizing FVWM even more

1180
In my last article on FVWM, the F Virtual Windows Manager, I wrote about its basic setup, how to create a task bar, and how to create your own menus. In this article I’ll be looking at further ways of customizing the windows manager to improve the basic desktop.

We already looked at how to build customized menus, but before we move on let’s have a look at the ones that come built in to FVWM. As before, all code should be placed in the file ~/.fvwm/.fvwm2rc (or one of the files that it can call using the Piperead command).

FVWM comes with some built in KDE menus for people who want a lighter desktop, but want easy access to some of KDE’s elements. To access them, use FVWM’s fvwm-menu-desktop module to create the KDE User and System menus:

AddToMenu kde-user
+ DynamicPopupAction PipeRead 'fvwm-menu-desktop --desktop kde-user'
AddToMenu kde-sys
+ DynamicPopupAction PipeRead 'fvwm-menu-desktop --desktop kde-sys'

Then add these new menus into the main structure:

AddToMenu Main Main Title
+ "KDE User Menu" Popup kde-user
+ "KDE System Menu" Popup kde-sys
+ "Restart%mini-turn.xpm%" Restart
+ "Exit%mini-exclam.xpm%" Quit

Using the GNOME Menus

FVWM also has some GNOME menus that you can make use of. However, they are handled slightly differently from the KDE menus:

Module FvwmGtk
*FvwmGtkMenu gnome-all
*FvwmGtkSubmenu "System" gnome-sys
*FvwmGtkSubmenu "User" gnome-user

PipeRead 'fvwm-menu-desktop --type gtk --enable-mini-icons'

PipeRead 'fvwm-menu-desktop --type gtk --desktop gnome-user --enable-mini-icons'

AddToMenu Main Main Title
+ "Gnome Menu" SendToModule FvwmGtk  gnome-all
+ "Restart%mini-turn.xpm%" Restart
+ "Exit%mini-exclam.xpm%" Quit

Using multiple desktops

So far we’ve worked with only one desktop, but you can actually have as many as you want by using FVWM’s FvwmPager, a utility that lets you move from one desktop to another.

First you need to tell FVWM which style FvwmPager should use. For example, to create FvwmPager without a title or a border, and to make sure that it is displayed on every desktop, use:

Style "FvwmPager" NoTitle, !Handles,  Sticky

Next, tell FvwmPager to display icons on desktops where we have applications running, and then to show a “balloon” that contains the name of the application when we place the mouse over the icon.

*FvwmPager: MiniIcons
*FvwmPager: Balloons All
*FvwmPager: BalloonColorset 0

You can also tell FvwmPager how many columns and rows to display. To display the desktops in a grid use:

*FvwmPager: Rows 3
*FvwmPager: Columns 3

If you want you can move the pager to somewhere other than the top left corner of the screen:

A note about window geometries

The window geometry statement can look confusing if you are not used to it, but the format is really simple. It consists of four elements: width, height, x offset, and y offset. Width and height are obvious enough — Geometry 100x50 will define a window 100 pixels wide by 50 high.

The x offset can be defined as either positive (setting the number of pixels the window lies from the left of the screen) or as negative (pixels from the right of the screen). Similarly, the y offset defines the number of pixels from the top of the screen (a positive number) or from the bottom of the screen (a negative number).

Examples are:

  • 100×50+100+100: 100 wide by 50 high, 100 from the left, 100 from the top;
  • +0-50: default size, 50 pixels from the bottom of the screen.
*FvwmPager: Geometry 100+0-100

Finally tell FVWM to display FvwmPager. You also need to tell FVWM the range of desktops. For example, to show three desktops use:

Module FvwmPager 0 2

You may want to use the Pager to move from screen to screen through each virtual desktop set (instead of moving the mouse cursor to the edge of the screen). If so, then set EdgeResistance, which controls how long you must hold your mouse close to the edge of the screen in order to change screens, to a high value:

EdgeResistance 100000 0

Now that you can move easily between the desktops you can further personalize them by giving them individual background colours. Although they look different, each of the following will work (the first two are older formats, the third is technically the correct one):

*FvwmBackerDesk 0 -solid yellow
*FvwmBacker: Desk 1 -solid yellow
*FvwmBacker: Command (Desk 2) -solid white

The changes will not be implemented until you instruct FVWM to update the screens during the initialization and the restart operations:


AddToFunc RestartFunction I Module FvwmBacker
AddToFunc InitFunction I Module FvwmBacker

Instead of colours you can define background images:


*FvwmBacker: Command (Desk 0) Exec xpmroot ~/images/dave-bowman-mono.xpm
*FvwmBacker: Command (Desk 1) Exec xpmroot ~/images/seven-at-moria-gates.xpm
*FvwmBacker: Command (Desk 2) Exec xpmroot ~/images/RigelVII-Holberg917G_fortress.xpm

You can even set each desktop screen (or page) with a different background:

*FvwmBacker: Command (Desk 2, Page 0 0) -solid midnightblue
*FvwmBacker: Command (Desk 2, Page 0 1) -solid magenta
*FvwmBacker: Command (Desk 2, Page 0 2) -solid white
*FvwmBacker: Command (Desk 2, Page 1 2) -solid skyblue

The FVWM button box

The last area we’ll look at is FvwmButtons — FVWM’s Button Box — a window that sits on the desktop and acts as a container for buttons or for active applications such as xload and xclock.

As always, set the look and feel first:

Style "FvwmButtons"     NoTitle,BorderWidth 0,HandleWidth 0,Sticky
*FvwmButtons: Back white
*FvwmButtons: Frame       1
*FvwmButtons: Geometry    500x64-0
*FvwmButtons: Rows        5
*FvwmButtons: Columns     64

Now we can do some of the interesting stuff. First we’ll add the active applications, which these will be displayed within the button box, but will be live.


*FvwmButtons: (6x5, Swallow "FvwmXclock" `Exec xclock -name FvwmXclock -geometry 40x40+0-3000 -padding 1 -analog -chime -bg white`)
*FvwmButtons: (20x5, Padding 0, Swallow "xload" `Exec xload`)

We can also add “normal” buttons — ones that you click to start the applications:


*FvwmButtons: (6x5,Title Firefox, Icon /opt/firefox/icons/mozicon50.xpm, Action `Exec "Firefox" firefox &`)
*FvwmButtons: (6x5,Title Thunderbird, Icon /opt/thunderbird/icons/mozicon50.xpm, Action `Exec "Thunderbird" thunderbird &`)

FVWMButtons must (just like the other modules we’ve looked at) be called from FVWM in order to work:

AddToFunc RestartFunction I Module FvwmButtons
AddToFunc InitFunctionI Module FvwmButtons

Using these techniques you can see that FVWM can produce a desktop that is light, fast, attractive, and above all does exactly what you need it to.