19.4. Customizing MenusAmong 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 the menus you have and what they offer are basically up to you. Typically the Root menu is defined as follows: 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 that 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 automatically 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 as seen by the user; types of lines include the menu title, a menu item proper, a blank line, and 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 ("") together with the Nop ("No operation") function create divider lines on the menu. The Popup function is worth looking at more closely. Popup specifies that a menu is displayed; the menu name is given as an argument to Popup. When Popup 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 start from the default menus in the system.fvwm2rc file and use 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 a new entry or even a menu from scratch. You can also change how the menus are displayed. Perhaps you don't want a bunch of cascading menus off 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). Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|