Basically, you as user don't need to know any of how and when the startupfiles
are created, but you might be interested to know anyway.
When a package that wants to add something to the menu tree gets installed, it
will run update-menus in it's postinst script.
Update-menus then reads in all menu files in /etc/menu//usr/lib/menu and /usr/lib/menu/default, and stores
the menu entries of all installed packages in memory. Once that has been done,
it will run the menu-methods in /etc/menu-methods/*, and pipe the
information about the menu entries to the menu-methods on stdout, so that the
menu-methods can read this. Each Window Manager or other program that wants to
have the debian menu tree, will supply a menu-method script in
/etc/menu-methods/. This menu-method then knows how to generate
the startup-file for that window manager. To facilitate this task for the
window-manager maintainers, menu provides a install-menu program.
This program can generate the startupfiles for just about every window manager.
In principle this is a very window-manager specific business. But for all
window managers (and others) applies:
The file to attack is the menu-method in /etc/menu-methods/$wm,
with $wm the name of your window manager. However, if this
menu-method !include-s the menu.h file (as it
should), you can also edit that file, to make your changes work for every
installed window manager.
If the menu-method file of your window manager does !include the
menu.h file, and makes proper use of the definitions in there,
then you can look at the comments in that menu.h file to see how
you can make minor adjustments to the look of your menus in your window
manager.
To generally change the menu tree, see the next section:
If in the /etc/menu-methods/* script appears the definition
hint_optimize=true (actually, that definition should appear in the
!include-ed menu.h file), then install-menu will try
to alter the menu tree, to make every submenu have about the optimum number of
menu entries (as specified by hints_nentry=...). It will do that
by removing under-full submenus (only if the `parent' of that submenu isn't
itself already overfull), and by possibly creating new submenus, using hints.
Note, however, that the optimization of the tree takes in principle exponential
time, so I've had to speedup the process, at the expense of occasionally not
finding the best tree. So, the tree you are presented with may not be optimal.
For tuning variables, see the hint_* variables in the last chapter.