Basic FVWM Configuration

If you've recently set up fvwm and are using the default system.fvwmrc, you'll find that clicking the left mouse button anywhere in the root window brings up a pop-up menu. Not all of those entries will be valid for your system. Here's how to change them.

If you've recently set up fvwm and are using the default system.fvwmrc, you'll find that clicking the left mouse button anywhere in the root window brings up a pop-up menu. What you may also quickly discover, to your dismay, is that many of these program items don't do anything, either because the program doesn't exist or is incorrectly set up.

Because of this, you'll probably want to remove these menu entries. Also, sooner or later, you'll install programs that you'd like to add to the pop-up menu. Or you may decide that you want to reorganize the menu into categories, such as Editors, Graphics, Viewers, Network Apps, and so forth. Whatever the reason, configuring the pop-up menus is easy and a huge amount of fun. So let's look at how it's done.

Suppose you do a lot of text-editing or programming and have several editors you enjoy using. You now want to organize the pop-up menu by program category and want to put all your favorite editors under one pop-up sub-menu, called Editors.

For the sake of simplicity, we'll leave out a discussion of using command line options for things such as geometry, foreground and background colors, fonts, and so forth. We'll use fairly simple examples and assume that you can go back later and customize the command line options.

Be sure you've made a backup copy of your current working version of .fvwmrc. After that, load up your favorite editor and open the file used to define the pop-up menus, .fvwmrc. This will include entries such as:

Popup "Applications"
  Title "Applications"
  Exec  "Wingz"     exec Wingz &
  Exec  "Xmgr Plot" exec xmgr -g 780x730+362+3 &
  Exec  "Ghostview" exec ghostview &
  Exec  "Seyon"     exec seyon -modem /dev/modem &
  Exec  "SciLab"    exec scilab &
  Exec  "X3270"     exec x3270 &
  Exec  "Xfilemanager" exec xfilemanager &
  Exec  "Xfm"       exec xfm &
  Exec  "Xgrab"     exec xgrab &
  Exec  "Xxgdb"     exec xxgdb &
EndPopup

Your .fvwmrc will probably look a bit different than this, so find the section of the file that defines Popup "name" ... EndPopup stanzas. Without fully understanding how things work, you could probably use an entry such as the above as a template and modify the entries to include the programs you want. What you'll discover, however, is that this isn't hard to understand.

An important point to keep in mind is that you must define sub-menus first, before you define the main menu. The reason for this is actually quite simple: when fvwm starts it reads the .fvwmrc configuration file from beginning to end. If you define the main menu first, it encounters references to menu items (your sub-menus) that haven't been defined yet, and so it is unable to correctly set up the menus. Also, sub-menus can be nested to any depth. Once you have a list of editors to add to a sub-menu, and you've worked out the command line options you intend to use, you're ready to start.

The basic entry for a menu takes the form:

Popup "name"
  Title  "title"
  Exec  "program"  exec command &
  Exec  "program"  exec command &
  Exec  "program"  exec command &
  Nop   ""
  Exec  "program"  exec command &
  Exec  "program"  exec command &
EndPopup

Let's briefly look at each part of the entry. The entry begins with the word Popup and a "name" which is used to refer to this menu itself (we'll see how this is used in a minute when we talk about adding a sub-menu to the main menu). The next line, beginning with the word Title, specifies the title that appears at the top of the menu. Notice that the title is enclosed in double quotes. Next are a series of familiar Exec stanzas, each of which is used to launch a program. This time, however, the word following Exec and enclosed in double quotes is the name that will appear on the menu. A stanza for the xedit editor might look something like:

  Exec "XEdit" exec xedit -font 9x15 -g +5+20 &

The menu would then include an entry with the name XEdit: clicking on this would launch the xedit program with the font and geometry options that are specified on the command line. Don't forget the ampersand (&) at the end of the entry.

You'll also notice a line which begins with the word Nop, which, as its name suggests (to some people, anyway), performs “no operation”. It does, however, allow you to create separator lines between menu items. Nop followed by a pair of double quotes with no spaces between them ("") creates a separator line. This is very useful for visually separating a list of items in the menu. However, if Nop is followed by double quotes with a space between them (" "), an empty entry is created between menu items instead of a line. Try both and see the difference.

Finally, the reserved word EndPopup is used to indicate that the menu has been defined. Pretty simple, eh? Once you understand how menus are defined, you can easily use an existing menu definition as a “template” for creating one of your own.

One more quick point to mention: it is possible to launch fvwm modules from a pop-up menu. As with the InitFunction entries mentioned last month, these are really quite simple and use the same form:

Module  "name"  module

For example, to start up the FvwmPager, you would add something like the following:

Module  "Pager"  FvwmPager

Notice two things: the menu item name for the module can be anything you want—it doesn't have to be the same as the module name. Second, you do not put an ampersand (&) at the end of the command line.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix