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


Book HomeLinux in a NutshellSearch this book

17.14. Customizing Menus

Among the window manager features and functions defined in the configuration file are the contents of menus. The system.fvwm2rc file generally defines a number of menus intended to be useful to a large percentage of people. But what menus you have, if any, and what they offer, are basically up to you.

Typically the Root menu would be defined:

AddToMenu RootMenu      "Root Menu"               Title
+                       "XTerm"                   Exec exec xterm
+                       "Rxvt"                    Exec exec rxvt
+                       ""                        Nop
+                       "Remote Logins"           Popup Remote-Logins
+                       ""                        Nop
+                       "Utilities"               Popup Utilities
+                       ""                        Nop
+                       "Fvwm Modules"            Popup Module-Popup
+                       "Fvwm Window Ops"         Popup Window-Ops
+                       "Fvwm Simple Config Ops"  Popup Misc-Ops
+                       ""                        Nop
+                       "Refresh Screen"          Refresh
+                       "Recapture Screen"        Recapture
+                       ""                        Nop
+                       "Exit Fvwm"               Popup Quit-Verify

You use the AddToMenu variable to create a menu. The first parameter AddToMenu takes is the name of the menu, in this case RootMenu. The menu name is used to reference the menu elsewhere in the configuration file (e.g., to specify a key binding to pop-up the menu). (Note that the AddToMenu variable and the menu name are repeated on each line of the menu definition, as indicated by the plus sign.

Each line of the definition creates a line on the menu; that may be the menu title, a menu item proper, a blank line, or a separator. The third component of each line specifies the text that appears on that line. The fourth component specifies the window manager function to be performed.

The first line of our example specifies the menu title. Lines with empty text fields ("") and the Nop function (which specifies "No operation") are used to create divider lines on the menu.

The Pop-up function is worth looking at more closely. Pop-up specifies that a menu is displayed; the menu name is given as an argument to Pop-up. When Pop-up is invoked from another menu, it creates a submenu (or cascading menu). This sample Root Menu definition has six submenus, named Remote-Logins, Utilities, Module-Popup, Window-Ops, Misc-Ops, and Quit-Verify. These menus would also be defined using the AddToMenu command, elsewhere in the configuration file.

You can use the sample menus in the system.fvwm2rc file and the fvwm2 manpage to modify the existing menus or create your own. It is simple to replace definition lines in the template menus and not much more difficult to write one from scratch.

You can also change how the menus are displayed. Perhaps you don't want a bunch of cascading menus off of the Root menu. In the previous section we set up some function keys to display certain menus. That's one option. You might instead specify pointer buttons to display various menus. In a typical default, the first pointer button displays the Root menu and the second displays the Window Ops menu. But since most Window Ops functions (e.g., Move, Resize, Iconify) are available using the pointer directly on parts of a window, you may instead choose to have the second pointer button display another menu (e.g., Utilities).



Library Navigation Links

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