(menu.info)Section 7.3


Next: Section 7.4 Prev: Section 7.2 Up: Chapter 7
Enter node , (file) or (file)node

7.3 The install-menu config script definitions
==============================================

The menu-methods in '/etc/menu-methods/*' are basically made up of a lot
of "tag=string" definitions, telling 'install-menu' how to generate a
'system.${wm}rc' script.  This way you can tune the look of generated
'system.${wm}rc' to your needs.

In the following, something like

       treewalk="c(m)"

means that the treewalk variable by default has the value "c(m)".

For examples of what these scripts can look like, see
'/usr/share/doc/menu/examples/*'.

'compat="menu-1"'
     Two mode are defined:

     '"menu-1"'
          menu directives are terminated by an end-of-line character.

     '"menu-2"'
          menu directives are terminated by a semicolon character.

     This must be just after the '!include "menu.h"' directive so that
     'menu.h' can use its own compat mode.

'outputencoding="UTF-8"'
     Set the encoding used for output files.  Use 'iconv --list' to get
     the list of supported encoding.  Useful values include "UTF-8" and
     "ISO-8859-1".  The special value "LOCALE" means that the current
     locale encoding will be used.  If set to an empty string, no
     translations are performed.  This is the default.

'outputlanguage=""'
     If set to "C" automatic translations will be disabled.  Note that
     you can still use translate() to perform explicit translation.

'supported'
'endsupported'
     Between the 'supported' and 'endsupported' keywords you define what
     "needs" are supported by this window manager.  So, the following is
     an example for a wm that supports both needs=x11 and needs=text:

            function q($s) = "\"" esc($s,"\\\"") "\""
            supported
              x11 =" ShowEntry(" q(title()) ", " q($command) ")"
              text=" ShowEntry(" q(title()) ", " q(term())   ")"
            endsupported

     For the variable substitution (and functions, not shown above), see
     the next paragraph.  In the above example, you'll notice that for
     the menu entries that "need=text", the term() function is used.
     This is a user-supplied function that will run $command in a X
     terminal emulator.  Also, as X11 is higher up in the supported list
     above than text, a package that supplies both a "needs=X11" and a
     "needs=text" entry will have the needs=X11 entry installed, in
     favour of the needs=text entry.  You can continue lines on the next
     line with a backslash ("\"), but make sure you don't add any spaces
     after the backslash.

'startmenu=""'
'endmenu=""'
'submenutitle=""'
     These define what to print for the beginning/end of a menu, and how
     to the print a menu entry that pops up another menu.  They are
     substituted the same way as the "supported" stuff is; see next
     paragraph.

'treewalk="c(m)"'
     This string defines in what order to dump the '$startmenu',
     '$endmenu', and '$submenutitle' (and its children).  Each char in
     the string refers to:

              c  : dump children of menu.
              m  : dump this menu's $submenutitles
              (  : dump $startmenu
              )  : dump $endmenu
              M  : dump all $submenutitles of this menu and this menu's children.

     The default is "c(m)".  For olvwm, one needs: "(M)"

'genmenu=""'
     The menu file to generate (usually something like
     'system."$wm"rc').  The file itself may depend on the level or
     title that is currently being worked on, like

              genmenu="/subdir/" replacewith($section," ","_") "/rc.menu"

     (Substitution works just like in the supported stuff, see above).
     Note that the files made this way are truncated upon opening, so if
     you have a genmenu like the example above, then your 'endmenu='
     will override the startmenu stuff (but you probably only need one
     of the two anyway).

'rootsection="/Debian"'
     the prefix every '$section' variable gets.

'prerun=""'
'postrun=""'
     The commands to run before and after, respectively, the actual
     generation of the 'menudefs.hook' (genmenu) file.  Commands will be
     executed by 'sh'.  Example:

            prerun="rm -rf " prefix() "/*"
            postrun="killall -USR1 fvwm2"

     (Substitution works just like the supported stuff, see below).

'preruntest=""'
     Just like prerun, but if the return value of the command is
     non-zero, menu will quit.

'also_run=""'
     If non-zero, install-menus will, after generating the output files,
     also load the file also_run, and use the new assignments to
     treewalk, genmenu, etc.  to generate more output.  This second
     time, variables like 'prerun' and all of the hint stuff are
     ignored.

'removemenu=""'
     The command to run when the menu-method is invoked with the option
     '--remove'.  This should remove all the autogenerated menu files.
     If this option is not present, then install menu will remove
     'genmenu' if it is a constant string and 'rcfile' if it is defined,
     and try to remove 'prefix()' if it is empty.

'onlyrunasroot=false'
'onlyrunasuser=false'
     If 'onlyrunasroot' is set to true, 'install-menu' will quit
     silently when run as a user.  Similarly for 'onlyrunasuser'.
     'ONLYRUNASROOT' IS DEPRECATED SINCE IT IS SIMPLER TO JUST NOT
     DEFINE 'USERPREFIX'. On the other hand, 'onlyrunasuser' might be
     needed if you use 'rcfile' since 'rootprefix' is used as a fallback
     location for the template.

'preoutput="#Automatically generated file. Do not edit (see /usr/share/doc/menu/html)\n\n"'
'postoutput=""'
     Text to put at the beginning resp.  end of the generated file
     ($genmenu).

'command=""'
     A command to run instead of 'install-menus'.  This command used to
     be needed to get around limitations due to compatibility stuff.
     But that compatibility with pre menu-1 stuff has been dropped, and
     isn't needed any more.

     Example:

            command="cat > /tmp/menu-stdin"

'hotkeyexclude=""'
     Keys not to use for hotkey generation.  You can use the same
     variables and functions here as in for example the startmenu
     sections.

     Example:

            hotkeyexclude="q" $section

'hotkeycase="insensitive"'
     can be either "insensitive" or "sensitive".  Determines whether the
     hotkeys can be of mixed case ('fvwm2' reads the hotkeys
     case-insensitive, 'pdmenu' case-sensitive).  In case of the titles
     "Xa" and "xb", hotkey case-insensitive will generate "X" and "b",
     whereas case-sensitive would generate "X" and "x".

'sort=$sort ":" $title'
     Entries within one menu will be alphabetically sorted by whatever
     sort returns.  So, if you do 'sort=ifelse($command, "1",
     "0"):$title', then all submenus will appear above the commands in a
     submenu.  (A submenu always has '$command=""').  Or, as Joey Hess
     writes:

            You can add another field to the menu items, with whatever name you like,
            let's say it's called priority. Then add this line to
            /etc/menu-methods/*:

            sort=ifelse($priority, $priority, "9")

            This has the result of sorting things so items with a low priority sort to the
            top, and items with no priority default to priority 9 and sort to the bottom.

            (Note that it compares the strings alphabetically, not numerically.)

'rcfile=""'
     If the window manager doesn't support an "include filename" or
     "read(filename)" statement in it's config file, you can rename the
     wm's config file to 'system."$wm"rc-menu', and insert a
     "install-menu-defs" line (without the quotes, or whitespace around
     it, and "install-menu-defs" must be the only thing on the line) in
     the 'system."$wm"rc-menu' file.  This will then get replaced by the
     '$genmenu' file that was just created (see also '$examplercfile').

'examplercfile=""'
     if needed (see 'rcfile'), this is the 'system.rc"$wm"-menu' file.
     In that case, make 'rcfile=system.rc"$wm"'.

'rootprefix=""'
     The prefix to use when running as root (applies to $genmenu,
     $rcfile, $examplercfile and other old cache files).  If it is not
     defined, the menu-method will be skipped when run as root.

'userprefix=""'
     As 'rootprefix', but when running as user.  userprefix is relative
     to the user home directory, unless it start with 2 slashes, in
     which case it is treated as an absolute path.  If it is not
     defined, the menu-method will be skipped when run as a user.

'hint_optimize=false'
     If set to true, menu will try to generate an 'optimal' tree, using
     the variables below.  If set to false, menu will keep the sections
     as they are specified in the menu entry files (and ignore any hint
     stuff).

'hint_nentry=6'
     Optimal number of entries in a submenu.  It's a float, so you can
     set it to 5.5 if you cannot decide between 5 and 6.  Also, values
     less than 3 probably don't work very well at the moment.

'hint_topnentry=5'
     Same as hint_nentry, but for the top level menu.  Often here are
     other entries, added by the window-manager itself (like Exit,
     Xterm, whatever) that menu doesn't know about, so that you may want
     to instruct menu to put less entries in the top level menu.

'hint_mixedpenalty=15.0'
     Penalty for 'mixed' menus.  Mixed menus are those with both
     submenus and direct commands in them.

'hint_minhintfreq=0.1'
     Minimal relative frequency for the hints before they are
     considered.  Internal variable to speed up the tree generation.  If
     you find menu slow, increase this value (to, say 0.2 or 0.3).

'hint_mlpenalty=2000'
     'max local penalty', while evaluating the possible trees, menu
     gives 'penalties' for submenus that don't contain the desired
     number of submenus.  The penalty is sqrt(n_entry_opt-n_entry), and
     eventually will be calculated as a sum of all nodes.  But to speed
     things up, menu will discard possibilities in which any node has a
     'local' penalty of more than hint_mlpenalty.  Increase this value
     if you think menu is overlooking your favorite tree (also decrease
     minhintfreq), decrease this value if you think menu is wasting too
     much time.  Because of hint_max_ntry, the influence of this
     variable is nearly zero nowadays.

'hint_max_ntry=4'
     menu will recursively, for each node, try the hint_max_ntry best
     local menu-divisions.

'hints_max_iter_hint=5'
     The search for what hints to use in one menu is rather expensive.
     But due to the way things are sorted, menu seems to always find the
     'best' match in the first 2% of iterations.  Thus, a way to speed
     things up is simply to cut of menu searching after 'some'
     iterations are done.  This value controls this, and limits the
     number of iterations to
     5+hint_max_iter_hint*number_of_possible_hints.  Set this value to
     negative to disable this.

'hint_debug=false'
     Set to true if you want to see loads and loads of debug output.


automatically generated by info2www version 1.2.2.9