17.13.3. Keyboard Shortcuts for Menu
and Window Manipulation
So far we've limited our keyboard shortcuts to scrolling the view and
moving the pointer. But you can create keyboard bindings for any
window manager function.
Here are some sample bindings to perform simple window operations and
to display a few menus:
# Keyboard accelerators
Key F1 A M Iconify
Key F2 A M Move
Key F3 A M Resize
Key F4 A M Popup "RootMenu"
Key F5 A M Popup "Misc-Ops"
Key F6 A M Popup "Utilities"
Key F7 A M Popup "Module-Popup"
Key F10 A M Restart fvwm2
Key F12 A SM Close
These are just sample bindings; you may want to set up your own
keyboard shortcuts to do entirely different things. But these bindings
will let us look at some of the possibilities, as well as potential
problems.
In our sample definition lines, the first binding specifies that if
you press the F1 function key while holding down the Meta "M" key,
with the pointer in any "A" context, the focus window will be
iconified (or deiconified). Meta+F2 lets you initiate moving the focus
window, while Meta+F3 starts a resize operation. (The Meta key is
described in the section "Keyboard Shortcuts to Navigate the Desktop,"
earlier in this chapter.)
Note that if you've adopted the keyboard bindings to move the pointer
(as described in the previous section), you can perform the move and
resize operations entirely with keystrokes. For example, use Meta+F2
to begin a move, then drag the window outline by moving the pointer
symbol using the appropriate keyboard shortcuts, then press the Return
key to complete the operation.
In addition, we've set up function keys to pop-up four different
menus, the contents of which are also defined in the
.fvwm2rc file. Once a menu is popped up, you can
use the up and down arrow keys to highlight items on the menu, right
and left keys to move down and up through submenus (cascading menus),
the Return key to select an item, and Esc to pop down the menu without
making a selection.
Because we do a lot of tinkering with fvwm2 customization, we have set up Meta+F10 to
restart the window manager. This is much faster than bringing up
menus.
We've also created a key combination to close the focus window:
Shift+Meta+F12. Certainly it's handy to be able to get rid of a window
with a keyboard shortcut, but you don't want it to be too easy or you
may do it by mistake. Having an extra modifying key (Shift) and using
the very last function key (F12) require you to act deliberately in
closing a window using this method.