L11 menu.sgml
(DEBIANDOC
AID IMPLIED
(BOOK
L13
(TITLEPAG
(TITLE
-Debian Menu System
L14
)TITLE
(AUTHOR
(NAME
-Joost Witteveen 
)NAME
(EMAIL
-joostje@debian.org
)EMAIL
L15
)AUTHOR
(AUTHOR
(NAME
-Joey Hess 
)NAME
(EMAIL
-joeyh@debian.org
)EMAIL
L16
)AUTHOR
(AUTHOR
(NAME
-Christian Schwarz 
)NAME
(EMAIL
-schwarz@debian.org
)EMAIL
L17
)AUTHOR
(VERSION
-version 1.3, 
(DATE
)DATE
-\n
L19
)VERSION
(ABSTRACT
L20
-The 
(TT
-menu
)TT
- package was inspired by the 
(TT
-install-fvwm2-menu
)TT
-\nprogram from the old 
(PRGN
-fvwm2
)PRGN
- package. However, 
(TT
-menu
)TT
- tries to\nprovide a more general interface for menu building.  With the\n
(PRGN
-update-menus
)PRGN
- command from this package, no package needs to be\nmodified for every X window manager again, and it provides a unified\ninterface for both text- and X-oriented programs.
L26
)ABSTRACT
L28
(COPYRIGHT
(COPYRIGHTSUMMARY
-Copyright \|[copy  ]\|1997 Joost Witteveen, Joey Hess, Christian Schwarz.
L29
)COPYRIGHTSUMMARY
(P
L30
-\nThis manual is free software; you may redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2, or (at your option) any\nlater version.
L35
)P
(P
L36
-\nThis is distributed in the hope that it will be useful, but\n
(EM
-without any warranty
)EM
-; without even the implied warranty of\nmerchantability or fitness for a particular purpose.  See the GNU\nGeneral Public License for more details.
L41
)P
(P
L42
-\nA copy of the GNU General Public License is available as\n
(TT
-/usr/share/common-licenses/GPL
)TT
- in the Debian GNU/Linux distribution\nor on the World Wide Web at\n
(TT
-http://www.gnu.org/copyleft/gpl.html
)TT
-. You can also obtain it\nby writing to the Free Software Foundation, Inc., 675 Mass Ave,\nCambridge, MA 02139, USA.
L49
)P
(P
L51
)P
)COPYRIGHT
)TITLEPAG
ADETAIL TOKEN SECT
(TOC
)TOC
AID IMPLIED
L53
(CHAPT
(HEADING
-Introduction
L54
)HEADING
(P
L55
-\nBefore  the  advent  of  
(TT
-update-menus
)TT
-,  when  the sysadmin\ninstalled a package onto a debian system, they would  need\nto  edit  various  window manager config files to make the\nnew program show up on, for  example,  
(TT
-fvwm
)TT
-'s  menus.  The\nmenus  could  easily become out of sync with what programs\nwere actually available, with some menu items that  didn't\nwork,  and  other  programs  that  lacked  a  menu  entry.\nupdate-menus and debian's menu package aim to  solve  this\nproblem.
L65
)P
(P
L66
-\n
(TT
-update-menus
)TT
-  automatically  generates  menus of installed\nprograms for window managers and other menu  programs.  It\nshould  be  run whenever a menu file or menu-method file\nis changed.  
(TT
-update-menus
)TT
- will be ran  automatically  when\ndebian  packages  that contain menu files are installed or\nremoved from the system. Users themselves can add/delete menu items,\nand should then run 
(TT
-update-menus
)TT
- as that user, thus creating\nwindow-manager startup files that are used in preference to the\nsystemwide files.
L76
)P
(P
L77
-\nOne problem we ran into with menu-1.x (and before) was that the\nnumber of entries in any submenu vary wildly: on my system there are\nonly two entries in /Apps/Editors, while I'm sure that other people\nhave more like 20 entries there. Many people complained about the\nfullness of certain submenus, citing scientific studies or personal\nexperience to explain why overfull or underfull submenus are a bad\nthing. To overcome this, menu-2.0 now can optimize the tree itself,\npossibly subdividing for example the /Apps/Editors tree in, say\nEditors/Beginner, Editors/Experienced, or whatever, if there are many\nentries in that submenu, or maybe even totally removing /Apps/Editors\non systems where there are few editors installed. To be able to do\nthis, menu follows the information supplied to it in the `hints'\nvariables (see paragraph below, or the hints chapter).\n\n
L93
)P
(P
L94
-\nEach package that needs to add an entry to the menu tree, \nincludes a menu file 
(TT
-/usr/lib/menu/package-name
)TT
-. In\nthis file, it will have one line per menu entry, like this (copied\nfrom 
(TT
-/usr/lib/menu/xbase
)TT
-):\n
ACOMPACT IMPLIED
(EXAMPLE
L100
-   ?package(xbase):command="/usr/bin/X11/xedit" needs="X11" \\\n                section="Apps/Editors" title="Xedit" \\\n                hints="Beginner,Small"
L103
)EXAMPLE
-\nThis describes the type of interface Xedit needs (X11),\nthe menu section the menu entry should be in,\nthe menu text, and the command that should be executed.\nAlso, it tells menu that, if /Apps/Editors is overfull, \nit could put Xedit in a Apps/Editors/Beginner or Apps/Editors/Small \nsubsection.\n
L111
)P
(P
L112
-\nWhenever 
(TT
-root
)TT
- runs 
(PRGN
-update-menus
)PRGN
-, it will check all\nmenu files in 
(TT
-/etc/menu
)TT
- and 
(TT
-/usr/lib/menu
)TT
-,\nand run the installation scripts that display managers like 
(PRGN
-fvwm2
)PRGN
-\nshould provide in 
(TT
-/etc/menu-methods
)TT
-.
L117
)P
(P
L118
-\nThe menu package itself provides a set of default menu files,\nfor people to get the idea, and to speed up things a bit.\n(These files should be incorporated into the package.)
L122
)P
(P
L123
-\nNote, that substantial and incompatible changes took place with the\nmenu-1.0 release, while substantial features were added by the release\nof menu-2.0. This document describes menu-2.0. \nMenu-2.0 now doesn't accept the menu-methods written for menu-0.x, but\nfor most window managers that still have those old menu-methods, I\nhave put new style menu-methods in /usr/share/doc/menu/examples. Everything\nwritten for menu-1.0 will work with menu-2.0.
L131
)P
(P
L132
-\nMost notable changes between menu-0.x and menu-1.x are listed in the file\nREADME.changes in the menu package, the features added by menu-2.0 can\nbe summarised here: hints, and the menu-2 compat mode. (where lines\nare finished by a ';' instead of a newline).\n
L138
)P
)CHAPT
AID IMPLIED
(CHAPT
(HEADING
-Menu from the viewpoint of a user
L139
)HEADING
(P
L140
)P
AID IMPLIED
(SECT
(HEADING
-How/when do the window manger startup files get created?
L141
)HEADING
(P
L142
-Basically, you as user don't need to know any of how and when the\nstartupfiles are created, but you might be interested to know anyway.
L144
)P
(P
L145
-When a package that wants to add something to the menu tree gets\ninstalled, it will run 
(TT
-update-menus
)TT
- in it's 
(TT
-postinst
)TT
- script.\nUpdate-menus then reads in all menu files in 
(TT
-/etc/menu/
)TT
-\n
(TT
-/usr/lib/menu
)TT
- and 
(TT
-/usr/share/menu/default
)TT
-, and stores\nthe menu entries of all installed packages in memory. Once that has\nbeen done, it will run the menu-methods in\n
(TT
-/etc/menu-methods/*
)TT
-, and pipe the information about the menu\nentries to the menu-methods on stdout, so that the menu-methods can\nread this. Each Window Manager or other program that wants to have\nthe debian menu tree, will supply a menu-method script in\n
(TT
-/etc/menu-methods/
)TT
-. This menu-method then knows how to\ngenerate the startup-file for that window manager. To facilitate this\ntask for the window-manager maintainers, menu provides a\n
(TT
-install-menu
)TT
- program. This program can generate the\nstartupfiles for just about every window manager.\n
L161
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Tuning of the generated window manager startup files
L162
)HEADING
(P
L163
-\nIn principle this is a very window-manager specific business.\nBut for all window managers (and others) applies:
L166
)P
(P
L167
-The file to attack is the menu-method in \n
(TT
-/etc/menu-methods/$wm
)TT
-, with 
(TT
-$wm
)TT
- the\nname of your window manager. However, if this menu-method\n
(TT
-!include
)TT
--s the 
(TT
-menu.h
)TT
- file (as it should), you can also edit\nthat file, to make your changes work for every installed window\nmanager.
L173
)P
(P
L174
-If the menu-method file of your window manager does 
(TT
-!include
)TT
- the\n
(TT
-menu.h
)TT
- file, and makes proper use of the definitions in there,\nthen you can look at the comments in that 
(TT
-menu.h
)TT
- file to see how\nyou can make minor adjustments to the look of your menus in your\nwindow manager.
L179
)P
(P
L180
-To generally change the menu tree, see the next section:\n
L182
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Optimization of menu tree: hints
L183
)HEADING
(P
L184
-If in the 
(TT
-/etc/menu-methods/*
)TT
- script appears the definition\n
(TT
-hint_optimize=true
)TT
- (actually, that definition should appear in\nthe 
(TT
-!include
)TT
--ed 
(TT
-menu.h
)TT
- file), then install-menu will try to\nalter the menu tree, to make every submenu have about the optimum\nnumber of menu entries (as specified by 
(TT
-hints_nentry=...
)TT
-). It\nwill do that by removing under-full submenus (only if the `parent' of\nthat submenu isn't itself already overfull), and by possibly creating\nnew submenus, using hints. Note, however, that the optimization of the\ntree takes in principle exponential time, so I've had to speedup the\nprocess, at the expense of occasionally not finding the best tree. So,\nthe tree you are presented with may not be optimal. For tuning\nvariables, see the hint_* variables in the last chapter.\n\n
L198
)P
)SECT
)CHAPT
AID IMPLIED
(CHAPT
(HEADING
-What packages with applications should do
L199
)HEADING
(P
L201
)P
AID IMPLIED
(SECT
(HEADING
-Registering your applications
L202
)HEADING
(P
L203
-A package should provide a menu file\n
(TT
-/usr/lib/menu/\|[lt    ]\|package-name\|[gt    ]\|
)TT
- that contains\ninformation about each program it likes to make available in the\nmenus.
L207
)P
(P
L208
-\nHere is an example to describe the syntax of such a file:\n
ACOMPACT IMPLIED
(EXAMPLE
L211
-?package(gnuplot):\\           specifies what packages need to be installed\n                              multiple requirements should be seperated by\n                              comma\n  needs=text\\                 what kind of terminal this command expects\n                              needs=X11: if this program runs only on X11\n                              needs=text: if it only runs on text terminals\n                                        (the window manager should spawn \n                                         an xterm or rxvt in this case)\n                              needs=vc: runs only at linux console\n                              needs=wm: this starts another window manager\n  section=Apps/Math\\          in what section this menu entry should be\n  title="Gnuplot"\\            the title of the menu entry (try to make it short)\n                              the title must be unique; two entries must not\n                              have the same title\n  command="/usr/bin/gnuplot"  the command to run.
L226
)EXAMPLE
L227
)P
(P
L228
-\nA program like gnuplot which can be run on X11 as well as on a text\nterminal should 
(EM
-not
)EM
- have an extra entry with 
(TT
-needs=X11
)TT
-\nbecause it will then be next to impossible to configure the window\nmanagers to spawn 
(PRGN
-rxvt
)PRGN
- instead of the default 
(PRGN
-xterm
)PRGN
-.
L233
)P
(P
L234
-\nOn the other hand, if a program (like 
(PRGN
-emacs
)PRGN
-) can be run as real X\napplication as well as in a terminal, two entries should be listed,\notherwise the program will always be run in an 
(PRGN
-xterm
)PRGN
- (or\n
(PRGN
-rxvt
)PRGN
-). Though you must remember, that two entries are never allowed\nto have the same title. The title must be unique.
L240
)P
(P
L241
-\nIn the menu entry files, you can use "#" as comment (like in shell scripts).
L243
)P
(P
L244
-\nYou should add a line like this to your 
(TT
-postinst
)TT
- script\n
ACOMPACT IMPLIED
(EXAMPLE
L247
- if test -x /usr/bin/update-menus; then update-menus; fi
L248
)EXAMPLE
-\nand the 
(TT
-postrm
)TT
- script should get the line\n
ACOMPACT IMPLIED
(EXAMPLE
L251
- if test -x /usr/bin/update-menus; then update-menus; fi
L252
)EXAMPLE
-\n(that is, the same line in postinst and in postrm).
L254
)P
(P
L255
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Preferred menu structure
L256
)HEADING
(P
L257
-The 
(EM
-authoritative list of Debian's menu structure
)EM
- is maintained\nin the Debian Menu sub-policy document which is part of the Debian\nPolicy package.
L260
)P
(P
L261
-The menu structure below is included only for convenience and is not authoritative. If it disagree with the structure in the Debian Menu sub-policy, please\nsend a wishlist bug to the 
(TT
-menu
)TT
- package.
L263
)P
(P
L264
-Please do 
(EM
-not
)EM
- put your packages into any other sections.
L265
)P
(P
L266
-\n
ACOMPACT IMPLIED
(EXAMPLE
L268
-       Apps            - normal apps\n         Databases     - interactive database programs\n         Editors       - text editors, word processors\n         Emulators     - dosemu, etc.\n         Graphics      - image manipulation\n         Hamradio      - anything relating to ham radio.\n         Math          - gnuplot, octave, oleo, etc.\n         Net           - mail, news, web, irc, etc.\n         Programming   - debuggers, etc.\n         Science       - scientific programs\n         Tools         - other tools: xclock, xmag, xman, etc.\n         Technical     - technical stuff.\n         Text          - text oriented tools other than editors.\n         Shells        - bash, ksh, zsh, etc.\n         Sound         - sound players and editors\n         Viewers       - image viewers\n         System        - system administration and monitoring tools\n       Games           - games and recreations\n         Adventure     - walk around virtual space, zork, MOO's, etc\n         Arcade        - any game where reflexes count\n         Board         - like gnuchess, pente, gnugo\n         Card          - solitaire, etc\n         Puzzles       - Stuff from xpuzzles, ...\n         Sports        - Games derived from "real world" sports\n         Strategy      - games involving long term strategic thinking\n         Tetris-like   - games involving falling blocks\n         Toys          - oneko, xeyes, etc.\n       Help            - programs that provide user documentation\n       Screen          - programs that affect the whole screen \n         Lock          - xlock, etc.\n         Save          - screen savers\n         Root-window   - things that fill the root window\n       WindowManagers  - X window managers \n         Modules       - window manager modules\n       XShells         - shells (like xterm, rxvt, ...)
L303
)EXAMPLE
-\nFor users wanting to access some menu entries quickly, you can also put\nentries in the root menu. This is done by using 
(EM
-section="/"
)EM
-.\nPackage provided menu entries must never use this feature.\n
L308
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Hints
L309
)HEADING
(P
L310
-Hints have been added starting from version 2.0.0 of menu. There needs\nto be some discussion about them first, but if you want to try them\nout, simply add a hints="Myhint,Herhint,Hishint" definition to the\nmenu entry file. For example:
L314
)P
(P
ACOMPACT IMPLIED
L315
(EXAMPLE
L316
-?package(emacs20):\\\n  needs="x11"\\\n  hints="Big,Expert,Featureful" \\\n  section="Apps/Editors"\\\n  title="Emacs 20"\\\n  command="/usr/bin/emacs20"\\\n  icon=/usr/share/emacs/20.3/etc/emacs.xbm
L323
)EXAMPLE
-\nThe above hints will case 
(TT
-menu
)TT
- to consider grouping 
(TT
-emacs
)TT
-\ntogether with other editors that are marked similar. For example, if\n
(TT
-vi
)TT
- on your system has a hints="Small,Expert" definition, and\nthere are too many entries in the /Apps/Editors menuentry, then menu\nwill consider creating a /Apps/Editors/Expert submenu, and put both\n
(TT
-vi
)TT
- and 
(TT
-emacs
)TT
- in it. (of course, only if you have \n
(TT
-hint_optimize=true
)TT
- in your /etc/menu-methods/menu.h file).\n
L332
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Icons
L333
)HEADING
(P
L334
-\nPlease, make sure the icons you specify are always available on the\nsystem. So, if you want to have an icon with your menu entry, the\npreferred method is to supply the icon with that package. Also, to\nprevent the distribution of icons files to turn too much into a mess,\nplease put all icon files in the directory\n
(TT
-/usr/share/pixmaps
)TT
-.
L341
)P
(P
L342
-\nDebian package maintainers should ensure that any icons they include\nfor use in the debian menus conform to the following points:\n
ACOMPACT IMPLIED
ACONTINUE IMPLIED
ANUMERATION TOKEN ARABIC
(ENUMLIST
L346
(ITEM
(P
-The icons should be in xpm format.
L347
)P
)ITEM
(ITEM
(P
-The icons may not be larger than 32x32 pixels, although smaller\nsizes are ok.
L349
)P
)ITEM
(ITEM
(P
-The icons should use only the 24 colors present in cmap.xpm,\nwhich comes with the 
(TT
-menu
)TT
- package.
L351
)P
)ITEM
(ITEM
(P
-The background area of the icon should be transparent, if\npossible.
L353
)P
)ITEM
)ENUMLIST
-\n\nIf you have Imagemagick installed, you can make your icons meet requirements\n1, 2, and 3 with the following command, but you will need to edit the icon\nafterwards to clean it up and make the background transparent:\n
ACOMPACT IMPLIED
(EXAMPLE
L359
-  $ mogrify -format xpm -geometry 32x32 -map cmap.xpm \|[lt    ]\|filenames\|[gt    ]\|
L360
)EXAMPLE
-\n\nIf you, as a system administrator, don't like the icons in the menus, simply\nremove the 
(TT
-$%{icon}
)TT
- from the files in\n
(TT
-/etc/menu-methods/$wm
)TT
-, and run 
(PRGN
-update-menus
)PRGN
-.
L365
)P
(P
L366
-\nIt's also possible to specify an icon for a sub-menu. However, if each\npackage would supply its own icons for the sub menus we can never be\nsure that the icon files are available. Thus, only the 
(TT
-menu
)TT
-\npackage is allowed to specify icons for sub menus. The syntax for this\nis:\n
ACOMPACT IMPLIED
(EXAMPLE
L373
-  X11 Apps menu/apps /usr/share/pixmaps/icon.xpm "Editors"
L374
)EXAMPLE
-\n
L376
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Fvwm's task and title bars
L377
)HEADING
(P
L378
-\nThe problem with the stuff in the task bar is that all items are\ndisplayed all of the time. So, if 1500 debian packages all were to\nregister a button, the buttons would quickly fill the screen, making\nthe exercise useless. The few applications that are considered\nimportant enough to be listed in the task bar usually vary widely on\neach system, making it impossible to select a ``happy few'' apps that\nare allowed there on every debian system. If you (as a local system\nadministrator) want your 
(PRGN
-fvwm2
)PRGN
- to have a few buttons, you can\ninstall files for those packages in 
(TT
-/menu/$package
)TT
-, containing\na menu entry like this:\n
ACOMPACT IMPLIED
(EXAMPLE
L390
-  ?Package(xmball):needs=button\\\n                section=Games/Puzzles\\\n                icon=path-to-pixmap.xpm\\\n                title="Xmball"\\\n                command=/usr/games/xmball
L395
)EXAMPLE
-\nThen, do the following:\n
ACOMPACT IMPLIED
(EXAMPLE
L398
-  cd /etc/menu-methods/\n  cp fvwm2 fvwm2button\n  vi fvwm2button
L401
)EXAMPLE
-\nand remove all the "supported" entries, adding the one below. For the rest,\nleave everything the same except those listed below.\n
ACOMPACT IMPLIED
(EXAMPLE
L405
-  supported \n    button="+ Style \\"" $title "\\" TitleIcon" $icon " Exec "  $command "\\n"\n  endsupported\n  startmenu:   "AddToTitlebar \\n"\n  endmenu:     "\\n"\n  submenutitle:""\n  mainmenu:\n  genmenu:   "buttondefs.hook"
L413
)EXAMPLE
-\n(Of course regular users (not system administrators) can also specify\n`buttonfiles' in their ~/.menu/ directory).\n
L417
)P
)SECT
)CHAPT
AID IMPLIED
(CHAPT
(HEADING
-What packages with menu managers should do
L418
)HEADING
(P
L419
-\nEach package containing a 
(EM
-menu manager
)EM
- (i.e. a program that can\ndisplay a menu) should provide a script or program in\n
(TT
-/etc/menu-methods/
)TT
- that can read the menu files. This script\nwill be executed by 
(PRGN
-update-menus
)PRGN
-, which will feed the menu\nentries to be installed to your script via standard input (stdin).
L425
)P
(P
L426
-\nThe scripts in 
(TT
-/etc/menu-methods/
)TT
- should be configuration\nfiles, so the user can tune the behaviour of the script. for the same\nreason they must always include the 
(TT
-/etc/menu-methods/menu.h
)TT
-\nconfiguration file at the beginning with the command 
(TT
-!include menu.h
)TT
-\n
L432
)P
(P
L433
-\nGood examples for these scripts for nearly all debian window managers\nare included in the 
(TT
-menu
)TT
- package in\n
(TT
-/usr/share/doc/menu/examples
)TT
-. Note that while working on your script,\nyou can use the tricks described in "The internals of the Menu\npackage", section "The update-menus program", to run just your script,\ninstead of having update-menus run all scripts (can save quite a lot\nof time).
L441
)P
(P
L442
-\nRun 
(PRGN
-update-menus
)PRGN
- (if it exists) in your 
(TT
-postinst
)TT
- script,\nand remove the execute bit from the 
(TT
-/etc/menu-methods/
)TT
- script\nin the 
(TT
-postrm
)TT
- when called with option ``remove.'' The\nwm-menu-config script is provided to make all this easier:
L447
)P
(P
L448
-\nHere is an example of such a 
(TT
-postrm
)TT
- script using 
(PRGN
-sh
)PRGN
-:\n
ACOMPACT IMPLIED
(EXAMPLE
L451
-  #!/bin/sh\n  set -e\n  wm=twm  #or pdmenu, fvwm, ... whatever manager you're installing\n  case "$1" in\n     remove)\n         if test -x /usr/sbin/wm-menu-config; then wm-menu-config $wm off;fi\n     ;;\n     purge)\n         #remove the files that install-menu creates:\n         (cd /etc/X11/twm/; rm system.twmrc menus.dat menudefs.hook)\n     ;;\n     upgrade);;\n     *)\n         echo "postrm called with unknown argument \\`$1'" >&2\n         exit 0\n     ;;\n  esac
L468
)EXAMPLE
-\n\nAnd here is a good example for a 
(TT
-postinst
)TT
- script:\n
ACOMPACT IMPLIED
(EXAMPLE
L472
-  #!/bin/sh\n  set -e\n  wm=pdmenu #or fvwm, ... whatever manager you're installing\n\n  if test -x /usr/sbin/wm-menu-config; then wm-menu-config $wm on;fi
L477
)EXAMPLE
-\n\n\nPlease, do not make your package 
(EM
-depend
)EM
- on the menu package! The\npreferred way of telling dpkg that your wm can cooperate with menu is:\n
ACOMPACT IMPLIED
(EXAMPLE
L483
-   Suggests: menu (>1.5)
L484
)EXAMPLE
-\nPlease only consider using "depends" if you feel providing reasonable\ndefaults for systems without menu will make life very difficult for you.
L487
)P
(P
L488
-\n\n
L491
)P
)CHAPT
AID IMPLIED
(CHAPT
(HEADING
-How a user can override the menus
L492
)HEADING
(P
L494
)P
AID IMPLIED
(SECT
(HEADING
-Configuring the menus
L495
)HEADING
(P
L496
-\nA user can specify his/her own menu entries in the 
(TT
-~/.menu
)TT
- directory.\nThe files can have an arbitrary file name as long as the new syntax\nfor the menu entries is used. They should start with either\n
ACOMPACT IMPLIED
(EXAMPLE
L501
-  ?package(installed-package):
L502
)EXAMPLE
-\nor\n
ACOMPACT IMPLIED
(EXAMPLE
L505
-  ?package(local.mystuff):
L506
)EXAMPLE
-\nif it's something that isn't ``debian-officially'' installed. (Any\n``package'' that starts with ``
(TT
-local.
)TT
-'' is considered installed.)
L509
)P
(P
L510
-\nIf a user wants to have his/her own menu methods, he/she should create\na 
(TT
-~/.menu-methods
)TT
- directory and put all scripts he/she wants to\nbe run in it. (If 
(TT
-~/.menu-methods
)TT
- exists,\n
(TT
-/etc/menu-methods
)TT
- will not be searched when a user runs\n
(PRGN
-update-menus
)PRGN
-).
L516
)P
(P
L517
-\nA system administrator should place system-wide menu entries in\n
(TT
-/etc/menu
)TT
- (not in 
(TT
-/usr/lib/menu/package
)TT
-, since these\nfiles will probably be overwritten by a package upgrade).
L521
)P
(P
L523
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Specifying a ``no-menu entry''
L524
)HEADING
(P
L525
-\nIf a user wants to remove an entry from the system menu (in\n
(TT
-/etc/menu
)TT
-), then this will do the trick:\n
ACOMPACT IMPLIED
(EXAMPLE
L529
-  echo -n  > ~/.menu/package
L530
)EXAMPLE
-\nThe zero-size file will tell 
(PRGN
-update-menus
)PRGN
- that the\ncorresponding package should not have any menu entries listed.
L533
)P
(P
L535
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Include: (one) other feature
L536
)HEADING
(P
L537
-\nMore out of curiosity than anything else, I recently read the KDE\nmailing list. In it I saw some discussion about how good the Debian\nmenu system is (whow, thanks, guys!), but one person found a missing\nfeature: s/he said you couldn't include other files in the user\nmenu files. Well, actually, it was already possible, but not very well\ndocumented. To include the contents of file /usr/lib/menu/somefile,\nadd this to your menu file:\n\n
ACOMPACT IMPLIED
(EXAMPLE
L547
-!include /usr/lib/menu/somefile
L548
)EXAMPLE
-\n\nApart form that, it is of course possible to make the menu entry file\nexecutable (
(TT
-chmod a+x ~/.menu/package
)TT
-), and do something like\n
ACOMPACT IMPLIED
(EXAMPLE
L553
-#!/bin/sh\ncat  /usr/lib/menu/somefile\nsed -e  "/unwanted_entry/s/?package(/?package(notinstalled./" \\\n     /usr/lib/menu/someotherfile
L557
)EXAMPLE
-\nto get the same effect, with the added flexibility of being able to\nfilter out unwanted lines.\n
L561
)P
)SECT
)CHAPT
AID IMPLIED
(CHAPT
(HEADING
-The internals of the menu package
L562
)HEADING
(P
L564
)P
AID IMPLIED
(SECT
(HEADING
-The update-menus program
L565
)HEADING
(P
L566
-\nOn startup, update-menus checks the file\n
(TT
-/var/run/update-menus.pid
)TT
- and the pid in it. If there's an\n
(PRGN
-update-menus
)PRGN
- process with that pid it kills it.\nIf 
(TT
-/var/lib/dpkg/lock
)TT
- exists, it forks to background and\nreturns control to dpkg. The background process checks the\n
(TT
-/var/lib/dpkg/lock
)TT
- file approx. every second until the file's\ngone. 
L574
)P
(P
L575
-\nAfter that, 
(PRGN
-update-menus
)PRGN
- reads the menu-entry-files in\nthe following directories:
(TT
- /etc/menu /usr/lib/menu /usr/share/menu/default
L578
)TT
-\n(if a user runs 
(PRGN
-update-menus
)PRGN
-, it will add ~/.menu to the\nfront of that list). For every menu entry line in each file it checks\nif the corresponding package is installed (works on file bases for old\nsyntax menu entry files). The menu entries of all "installed" packages\nare added together in one big buffer that is kept in memory (exception:\nexecutable menu entry files are executed, and stdout is placed in\nthe buffer). 
L586
)P
(P
L587
-Once it's read all menu entry files, 
(PRGN
-update-menus
)PRGN
- starts all\nexecutable scripts in /etc/menu-methods/, hands the scripts the\npreviously created buffer via stdin. (If 
(PRGN
-update-menus
)PRGN
- is ran by\na user, it will first try to run the scripts in ~/.menu-methods, and\nonly if that directory doesn't exist, it will run the scripts in\n/etc/menu-methods). 
L593
)P
(P
L594
-\nNote that as an aid to debugging, one can use\n
ACOMPACT IMPLIED
(EXAMPLE
L597
-update-menus --stdout > /tmp/menu-stdin
L598
)EXAMPLE
-\nand then view the file /tmp/menu-stdin to see exactly what\n
(TT
-update-menus
)TT
- handed the menu-methods on their stdin.
L601
)P
(P
L602
-\nThis may also be useful for people\nwriting /etc/menu-method/* scripts: Running 
(PRGN
-update-menus
)PRGN
- every\ntime you changed something in the script may be quite\ntime-consuming. So, it's much easier to run \n
(PRGN
-update-menus --stdout
)PRGN
- once, and then run\n
ACOMPACT IMPLIED
(EXAMPLE
L609
-  /etc/menu-methods/mymethod < /tmp/menu-stdin
L610
)EXAMPLE
-\n(and, if that also takes too long, just try editing /tmp/menu-stdin,\nand removing 90% or so of all entries)\n
L614
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-The install-menu program
L615
)HEADING
(P
L616
-\nThe files 
(TT
-/etc/menu-methods/$wm
)TT
- are executable config\nfiles that start with the line\n
ACOMPACT IMPLIED
(EXAMPLE
L620
-  #!/usr/sbin/install-menu
L621
)EXAMPLE
-\nand thus start that program, handing it the configuration file for the\nspecific window manager in the first command line argument. This\nconfiguration consists of:\n
ACOMPACT IMPLIED
ACONTINUE IMPLIED
ANUMERATION TOKEN ARABIC
(ENUMLIST
L626
(ITEM
(P
-the compatibility mode ("menu-1" or "menu-2").
L627
)P
)ITEM
(ITEM
(P
-where the various files should be stored/read.
L628
)P
)ITEM
(ITEM
(P
-what "needs" are supported, and what wrapper files should\n   be used for each "type".
L630
)P
)ITEM
)ENUMLIST
-\nSee 
(TT
-/usr/share/doc/menu/examples/
)TT
- of the menu package for more\ncomments.
L633
)P
(P
L634
-\nOptions to 
(PRGN
-install-menu
)PRGN
-:\n
ACOMPACT IMPLIED
(EXAMPLE
L637
-  -v              be verbose\n  -d              Produce loads of debugging output
L639
)EXAMPLE
L640
)P
(P
L641
-\nSome window managers don't support an `include' like statement in\ntheir 
(TT
-system.*rc
)TT
- files (like 
(PRGN
-m4
)PRGN
- or 
(PRGN
-cpp
)PRGN
-\npreprocessing), they cannot read the 
(TT
-menudefs.hook
)TT
- file generated\nby install-menu from their\n
(TT
-system.*rc
)TT
- config file. To still be able to use them,\n
(PRGN
-install-menu
)PRGN
- will copy the file\n
(TT
-$path/$examplercfile
)TT
- to 
(TT
-$path/$rcfile
)TT
- (with \n
(TT
-$examplercfile
)TT
- and 
(TT
-$rcfile
)TT
- defined in the\n
(PRGN
-install-menu
)PRGN
- config file, and 
(TT
-$path
)TT
- eihter the\n
(TT
-$rootprefix
)TT
- or 
(TT
-${HOME}/userprefix
)TT
-, depending on whether root\nor user executed the file.), and replace all occurrences of\n``install-menu-defs'' with the 
(TT
-$genmenu
)TT
- file it just\ngenerated. 
L655
)P
(P
L656
-As an example, consider the following:\n
(TT
-examplercfile=system.foo-wm-example
)TT
-,\n
(TT
-rcfile=system.foo-wm
)TT
-, 
(TT
-genmenu=menudefs.hook
)TT
- and\n
(TT
-rootprefix=/etc/X11/foo-wm
)TT
-. Now, if 
(PRGN
-install-menu
)PRGN
- gets run, it\nwill first generate the file\n
(TT
-/etc/X11/foo-wm/menudefs.hook
)TT
-. Next, it will line-by-line \nread the file 
(TT
-/etc/X11/foo-wm/system.foo-wm-example
)TT
- and copy\nit's contents to 
(TT
-/etc/X11/foo-wm/system.foo-wm
)TT
-, replacing\nevery occurrence of the string 
(TT
-install-menu-defs
)TT
- by the\ncontents\nof the file 
(TT
-/etc/X11/foo-wm/menudefs.hook
)TT
-. 
L667
)P
(P
L668
-\nTo activate the file copying in this way, simply define the\n
(TT
-$examplercfile
)TT
- and 
(TT
-$rcfile
)TT
- variables in the\n
(PRGN
-install-menu
)PRGN
- configuration file\n(for example, see 
(TT
-/etc/menu-methods/fvwm
)TT
-), and make sure there is a\n
(TT
-$path/$examplercfile
)TT
- (
(TT
-$path
)TT
- being either\n
(TT
-$rootprefix
)TT
-, or 
(TT
-$userprefix
)TT
-.)
L675
)P
(P
L676
-\nIf you are wringing a menu method, you can use the following to\ndebug it somewhat easier:\n
ACOMPACT IMPLIED
ACONTINUE IMPLIED
ANUMERATION TOKEN ARABIC
(ENUMLIST
L680
(ITEM
(P
-use the "cat" menu-method in 
(TT
-/usr/share/doc/menu/examples/cat
)TT
-\nto create a list of menu entries in 
(TT
-/tmp/menu-stdin
)TT
- (put it in\n
(TT
-~/.menu-methods
)TT
-, and run 
(PRGN
-update-menus
)PRGN
-), and then
L683
)P
)ITEM
(ITEM
(P
-you can run just your menu-method with (if it's called wm):\n
ACOMPACT IMPLIED
(EXAMPLE
L685
-  ./wm -v < /tmp/menu-stdin 
L686
)EXAMPLE
-\n(Use 
(TT
--v
)TT
- for verbose, 
(TT
--d
)TT
- for debugging, and you'll get loads\nof output!)
L689
)P
)ITEM
)ENUMLIST
L690
)P
(P
L692
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-The install-menu config script definitions
L693
)HEADING
(P
L694
-\nThe menu-methods in 
(TT
-/etc/menu-methods/*
)TT
- are basically made up of\na lot of ``tag=string'' definitions, explaining 
(PRGN
-install-menu
)PRGN
-\nhow to generate a 
(TT
-system.$wmrc
)TT
- script. This way you can tune\nthe look of generated 
(TT
-system.$wmrc
)TT
- to your needs.
L699
)P
(P
L700
-\nIn the following, something like \n
ACOMPACT IMPLIED
(EXAMPLE
L703
-  treewalk="c(m)"
L704
)EXAMPLE
-\nmeans that the treewalk variable by default has the value "c(m)".
L706
)P
(P
L707
-\nFor examples of what these scripts can look like, see\n
(TT
-/usr/share/doc/menu/examples/*
)TT
-.
L710
)P
(P
L711
-\n
ACOMPACT IMPLIED
(TAGLIST
L713
(TAG
(TT
-compat="menu-1"
)TT
L714
)TAG
(ITEM
L715
(P
-Should always be "menu-1". Please, make this the first non-comment\nline in the script.\n
L718
)P
)ITEM
(TAG
(TT
-supported
)TT
L719
)TAG
(TAG
(TT
-endsupported
)TT
L720
)TAG
(ITEM
L721
(P
-Between the 
(TT
-supported
)TT
- and 
(TT
-endsupported
)TT
- keywords you define\nwhat "needs" are supported by this window manager. So, the following\nis an example for a wm that supports both needs=x11 and needs=text:\n
ACOMPACT IMPLIED
(EXAMPLE
L725
-  supported\n    x11=" ShowEntry(\\"" $title "\\", \\"" $command "\\")"\n    text="  ShowEntry(\\"" $title "\\", \\"" $command \n             "xterm -T " $title " -e " $command "\\")"\n  endsupported
L730
)EXAMPLE
-\n\nFor the variable substitution (and functions, not shown above), see\nthe next paragraph. In the above example, you'll notice that for the\nmenu entries that "need=text", an xterm is spawned for the command to\nrun in.  Also, as x11 is higher up in the supported list above than text, a\npackage that supplies both a "needs=x11" and a "needs=text" entry will\nhave the needs=x11 entry installed, in favour of the needs=text entry.\nYou can continue lines on the next line with a \\, but do make sure you\ndon't add any spaces after the \\.\n
L741
)P
)ITEM
(TAG
(TT
-startmenu=""
)TT
L742
)TAG
(TAG
(TT
-endmenu=""
)TT
L743
)TAG
(TAG
(TT
-submenutitle=""
)TT
L744
)TAG
(ITEM
L745
(P
-These define what to print for the beginning/end of a menu, and\nhow to the print a menu entry that pops up another menu entry.\nThey are substituted the same way as the "supported" stuff is.\n(see next paragraph).\n
L750
)P
)ITEM
(TAG
(TT
-treewalk="c(m)"
)TT
L751
)TAG
(ITEM
L752
(P
-This string defines in what order to dump the 
(TT
-$startmenu
)TT
-, 
(TT
-$endmenu
)TT
-,\nand 
(TT
-$submenutitle
)TT
- (and its children). Each char in the string\nrefers to:\n
ACOMPACT IMPLIED
(EXAMPLE
L756
-    c  : dump children of menu.\n    m  : dump this menu's $submenutitles\n    (  : dump $startmenu\n    )  : dump $endmenu\n    M  : dump all $submenutitles of this menu and this menu's children.
L761
)EXAMPLE
-\n\nThe default is "c(m)". For olvwm, one needs: "(M)"\n
L765
)P
)ITEM
(TAG
(TT
-genmenu=""
)TT
L766
)TAG
(ITEM
L767
(P
-The menu file to generate (usually something like 
(TT
-system."$wm"rc
)TT
-).\nThe file itself may depend on the level or title that is currently\nbeing worked on, like \n
ACOMPACT IMPLIED
(EXAMPLE
L771
-    genmenu="/subdir/" replacewith($section," ","_") "/rc.menu"
L772
)EXAMPLE
-\n(Substitution works just like in the supported stuff, see above).\nNote that the files made this way are truncated upon\nopening, so if you have a genmenu like the example above, then\nyour 
(TT
-endmenu=
)TT
- will override the startmenu stuff (but you probably\nonly need one of the two anyway).\n
L779
)P
)ITEM
(TAG
(TT
-rootsection="/Debian"
)TT
L780
)TAG
(ITEM
L781
(P
-the prefix, every 
(TT
-$section
)TT
- variable gets.\n
L783
)P
)ITEM
(TAG
(TT
-prerun=""
)TT
L784
)TAG
(TAG
(TT
-postrun=""
)TT
L785
)TAG
(ITEM
L786
(P
-The commands to run before resp. after the actual generation of the\n
(TT
-menudefs.hook
)TT
- (genmenu) file. Commands will be executed by 
(PRGN
-sh
)PRGN
-.\nExample: \n
ACOMPACT IMPLIED
(EXAMPLE
L790
-  prerun="rm -rf " prefix() "/*"\n  postrun="killall -USR1 fvwm2"
L792
)EXAMPLE
-\n(Substitution works just like the supported stuff, see below).
L794
)P
)ITEM
(TAG
(TT
-preruntest=""
)TT
L795
)TAG
(ITEM
L796
(P
-Just like prerun, but if the return value of the command is non-zero,\nmenu will quit.
L798
)P
)ITEM
(TAG
(TT
-also_run=""
)TT
L799
)TAG
(ITEM
L800
(P
-If non-zero, install-menus will, after generating the output files,\nalso load the file also_run, and use the new assignments to treewalk,\ngenmenu, etc to generate more output. This second time, variables like\n
(TT
-prerun
)TT
- and all of the hint stuff are ignored.
L804
)P
(P
L805
-Note: NOT just like 
(TT
-prerun
)TT
- etc: 
(TT
-prerun
)TT
- etc start a command\nwith /bin/sh, 
(TT
-also_run
)TT
- doesn't exec any other command, just tells\ninstall-menu to also load anoter binary, and generate the output.\n
L809
)P
)ITEM
(TAG
(TT
-onlyrunasroot=false
)TT
L810
)TAG
(TAG
(TT
-onlyrunasuser=false
)TT
L811
)TAG
(ITEM
L812
(P
-If onlyrunasroot is set to true, menu will quit silently when run as\nuser. Similarly for onlyrunasuser.\n
L815
)P
)ITEM
(TAG
(TT
-preoutput="#Automatically generated file. Do not edit (see /usr/share/doc/menu/html)\\n\\n"
)TT
L816
)TAG
(TAG
(TT
-postoutput=""
)TT
L817
)TAG
(ITEM
L818
(P
-Text to put at the beginning resp. end of the generated file ($genmenu).\n
L820
)P
)ITEM
(TAG
(TT
-command=""
)TT
L821
)TAG
(ITEM
L822
(P
-A command to run instead of 
(PRGN
-install-menus
)PRGN
-. This command used\nto be needed to get around limitations due to compatibility stuff. But\nthat compatibility with pre menu-1 stuff has been dropped, and isn't\nneeded any more.
L826
)P
(P
L827
-\nExample:\n
ACOMPACT IMPLIED
(EXAMPLE
L830
-  command="cat > /tmp/menu-stdin"
L831
)EXAMPLE
-\n
L833
)P
)ITEM
(TAG
(TT
-hotkeyexclude=""
)TT
L834
)TAG
(ITEM
L835
(P
-Keys not to use for hotkey generation. You can use the same \nvariables and functions here as in for example the startmenu\nsections.
L838
)P
(P
L839
-\nExample:\n
ACOMPACT IMPLIED
(EXAMPLE
L842
-  hotkeyexclude="q" $section
L843
)EXAMPLE
-\n
L845
)P
)ITEM
(TAG
(TT
-hotkeycase="insensitive"
)TT
L846
)TAG
(ITEM
L847
(P
-can be either "insensitive" or "sensitive". Determines\nwhether the hotkeys can be of mixed case (
(TT
-fvwm2
)TT
- reads\nthe hotkeys case-insensitive, 
(TT
-pdmenu
)TT
- case-sensitive).\nIn case of the titles "Xa" and "xb", hotkey case-insensitive will\ngenerate "X" and "b", whereas case-sensitive would generate "X" and\n"x".
L853
)P
(P
L855
)P
)ITEM
(TAG
(TT
-sort=$sort ":" $title
)TT
L856
)TAG
(ITEM
L857
(P
-Entries within one menu will be alphabetically sorted by whatever\nsort returns. So, if you do \n
(TT
-sort=ifelse($command, "1", "0"):$title
)TT
-, then all submenus will\nappear above the commands in a submenu. (A submenu always has \n
(TT
-$command=""
)TT
-). Or, as Joey Hess writes:\n
ACOMPACT IMPLIED
(EXAMPLE
L863
-  You can add another field to the menu items, with whatever name you like,\n  let's say it's called priority. Then add this line to\n  /etc/menu-methods/*:\n  \n  sort=ifelse($priority, $priority, "9")\n  \n  This has the result of sorting things so items with a low priority sort to the\n  top, and items with no priority default to priority 9 and sort to the bottom.\n  \n  (Note that it compares the strings alphabetically, not numerically.)
L873
)EXAMPLE
-\n
L875
)P
)ITEM
(TAG
(TT
-rcfile=""
)TT
L876
)TAG
(ITEM
L877
(P
-If the window manager doesn't support an "include filename" or\n"read(filename)" statement in it's config file, you can rename\nthe wm's config file to 
(TT
-system."$wm"rc-menu
)TT
-, and insert\na "install-menu-defs" line (without the quotes, or whitespace around\nit, and "install-menu-defs" must be the only thing on the line)\nin the 
(TT
-system."$wm"rc-menu
)TT
- file. This will then get replaced\nby the 
(TT
-$genmenu
)TT
- file that was just created (see\nalso 
(TT
-$examplercfile
)TT
-).
L885
)P
(P
L886
-  
L887
)P
)ITEM
(TAG
(TT
-examplercfile=""
)TT
L888
)TAG
(ITEM
L889
(P
-if needed (see 
(TT
-rcfile
)TT
-), this is the 
(TT
-system.rc"$wm"-menu
)TT
-\nfile. In that case, make 
(TT
-rcfile=system.rc"$wm"
)TT
-.
L891
)P
(P
L893
)P
)ITEM
(TAG
(TT
-rootprefix=""
)TT
L894
)TAG
(ITEM
L895
(P
-The prefix to use when running as root (applies to $genmenu, $rcfile,\n$examplercfile  and other old cache files)\n
L898
)P
(P
L899
)P
)ITEM
(TAG
(TT
-userprefix=""
)TT
L900
)TAG
(ITEM
L901
(P
-see 
(TT
-rootprefix
)TT
-, but when running as user.
L902
)P
(P
L904
)P
)ITEM
(TAG
(TT
-process_menudirs="user,system"
)TT
L905
)TAG
(ITEM
L906
(P
-Directories that 
(TT
-install-menu
)TT
- will process menu entry files from\n(new in menu-2.1.6).\nThe default is "
(TT
-user
)TT
-, 
(TT
-etc
)TT
-, 
(TT
-debian
)TT
-, 
(TT
-default
)TT
-", which means that\n
(TT
-install-menu
)TT
- will read files found in 
(TT
-${HOME}/.menu
)TT
-, then in\n
(TT
-/etc/menu
)TT
-, then in 
(TT
-/usr/lib/menu
)TT
-, and last in\n
(TT
-/usr/share/menu/default
)TT
-. To make life easier, there's an alias for\nthe 
(TT
-etc
)TT
-, 
(TT
-debian
)TT
-, 
(TT
-default
)TT
- locations: 
(TT
-system
)TT
-.\nNote that the order in which you specify\nthe locations doesn't matter.
L915
)P
(P
L916
-To be complete, 
(TT
-user
)TT
-=
(TT
-"${HOME}/.menu"
)TT
-; 
(TT
-etc
)TT
-=
(TT
-"/etc/menu"
)TT
-;\n
(TT
-debian
)TT
-=
(TT
-"/usr/lib/menu"
)TT
-;\n
(TT
-default
)TT
-=
(TT
-"/usr/share/menu/default"
)TT
-; 
(TT
-system
)TT
-=
(TT
-"/etc/menu
)TT
-,\n
(TT
-/usr/lib/menu
)TT
-, 
(TT
-/usr/share/menu/default"
)TT
L920
)P
(P
L921
-If you have a WM which allows an "incremental" user configuration file\n(with only the menu entries of the users), then you may want to\nspecify:\n
ACOMPACT IMPLIED
(EXAMPLE
-process_menudirs="user, " ifroot(system)
L925
)EXAMPLE
-\nThis will cause 
(TT
-install-menu
)TT
- to discard all system menu entry\nfiles if run as normal user, and the user's WM-config file can\n
(TT
-#include
)TT
- the system menu definitions from\n
(TT
-/etc/WM/*
)TT
-. Note that if you do this, you disable an elswehere\nin this manual advertised feature: if the user does 
(TT
- true >\n~/.menu/package 
)TT
-, then the user doesn't have the menu entry files\nfrom 
(TT
-package
)TT
-. But as in your case the user's WM-config file\n
(TT
-#include
)TT
-s the system wide menu defintions, this will not work any more.
L934
)P
(P
L935
-The way this feature works may not be the one you at first glance\nexpect: when the user or system admin runs 
(TT
-update-menus
)TT
-, it will\nread all menu entry files in all directories (user, etc, debian and\ndefault). 
(TT
-update-menus
)TT
- then generates one big list of the\nconcatenated files (whose packages are installed), and hands that file\nto the stdin of the 
(TT
-install-menu
)TT
- program in\n
(TT
-/etc/menu-methods/*
)TT
-. That program then reads the\n
(TT
-process_menudirs
)TT
- variable, and starts processing the input given\nby 
(TT
-update-menus
)TT
-. And it will discard any menu\nentry files if they appear to originate from a directory not specified\nin 
(TT
-process_menudirs
)TT
-. Due to this implementation, it is not\npossible for 
(TT
-install-menu
)TT
- to read menu entry files outside the\nstandard user, etc, debian and default directories, and also the order\nof the directories in 
(TT
-process_menudirs
)TT
- has no effect. Also, as\n
(TT
-update-menus
)TT
-, when ran under root will not process the user's\n(root) home dir, so the 
(TT
-user
)TT
- setting in 
(TT
-process_menudirs
)TT
-\nwill simply have no effect.
L952
)P
(P
L954
)P
)ITEM
(TAG
(TT
-repeat_lang=""
)TT
L955
)TAG
(ITEM
L956
(P
-If set to "LOCALE", then menu will automatically translate all title's\nto the languages specified by the current LC_LOCALE setting. (LC_ALL,\n...). It is intended to expand this to 
(TT
-repeat_lang="en:es:eo:nl"
)TT
-,\nwhich would repeatedly run install-menus for the various specified\nlanguages. But the latter hasn't yet been implemented.\n
L962
)P
)ITEM
(TAG
(TT
-hint_optimize=false
)TT
L963
)TAG
(ITEM
L964
(P
-If set to true, menu will try to generate an `optimal' tree, using\nthe variables below. If set to false, menu will keep the sections as\nthey are specified in the menu entry files (and ignore any hint stuff).\n
L968
)P
)ITEM
(TAG
(TT
-hint_nentry=6
)TT
L969
)TAG
(ITEM
L970
(P
-Optimal number of entries in a submenu. It's a float, so you can set\nit to 5.5 if you cannot decide between 5 and 6. Also, values less \nthan 3 probably don't work very well at the moment.\n
L974
)P
)ITEM
(TAG
(TT
-hint_topnentry=5
)TT
L975
)TAG
(ITEM
L976
(P
-Same as hint_nentry, but for the top level menu. Often here are other\nentries, added by the Window Manager itself (like Exit, Xterm,\nwhatever) that menu doesn't know about, so that you may want to\ninstruct menu to put less entries in the top level menu.\n
L981
)P
)ITEM
(TAG
(TT
-hint_mixedpenalty=15.0
)TT
L982
)TAG
(ITEM
L983
(P
-Penalty for `mixed' menus. Mixed menus are those with both submenus\nand direct commands in them.\n
L986
)P
)ITEM
(TAG
(TT
-hint_minhintfreq=0.1
)TT
L987
)TAG
(ITEM
L988
(P
-Minimal relative frequency for the hints before they are considered.\nInternal variable to speed up the tree generation. If you find menu\nslow, increase this value (to, say 0.2 or 0.3).\n
L992
)P
)ITEM
(TAG
(TT
-hint_mlpenalty=2000
)TT
L993
)TAG
(ITEM
L994
(P
-`max local penalty',\nwhile evaluating the possible trees, menu gives `penalties' for\nsubmenus that don't contain the desired number of submenus. The\npenalty is sqrt(n_entry_opt-n_entry), and eventually will be\ncalculated as a sum of all nodes. But to speed things up, menu will\ndiscard possibilities in which any node has a `local' penalty of more\nthan hint_mlpenalty. Increase this value if you think menu is\noverlooking your favorite tree (also decrease minhintfreq), decrease\nthis value if you think menu is wasting too much time.\nBecause of hint_max_ntry, the influence of this variable is nearly\nzero nowadays.
L1005
)P
)ITEM
(TAG
(TT
-hint_max_ntry=4
)TT
L1006
)TAG
(ITEM
L1007
(P
-menu will recursively, for each node, try the hint_max_ntry best local\nmenu-divisions.\n
L1010
)P
)ITEM
(TAG
(TT
-hints_max_iter_hint=5
)TT
L1011
)TAG
(ITEM
L1012
(P
-The search for what hints to use in one menu is rather expensive. But\ndue to the way things are sorted, menu seems to always find the `best'\nmatch in the first 2% of iterations. Thus, a way to speedup things is\nsimply to cut of menu searching after `some' iterations are\ndone. This value controls this, and limits the number of iterations to \n5+hint_max_iter_hint*number_of_possible_hints. Set this value to\nnegative to disable this.\n
L1020
)P
)ITEM
(TAG
(TT
-hint_debug=false
)TT
L1021
)TAG
(ITEM
L1022
(P
-Set to true if you want to see loads and loads of debug output.
L1023
)P
)ITEM
)TAGLIST
-\n
L1025
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Hints, tree optimization
L1026
)HEADING
(P
L1027
-The hints actually work in a rather strange way: when\n
(TT
-hint_optimize=true
)TT
- then all 
(TT
-$section
)TT
- elements are added to\nthe specified 
(TT
-$hints
)TT
- variable, and the order (/Apps/Editors or\n/Editors/Apps) of the resulting hints is completely ignored. Then, the\nhints for each menu entry are handed to the optimization routine, that\nwill calculate a reasonable tree for those hints. That tree must\ncomply with the following:
L1034
)P
(P
L1035
-\nWhen a user looks for a program "Program" with, say, hints \n"Good,Bulky,Heaven", then, while walking through the tree, it should at\nevery node visited\nbe clear for the user what submenu to select (or the menu should have\n"Program" directly in it). So, the toplevel menu may\nlook like\n
ACOMPACT IMPLIED
(EXAMPLE
L1043
-  Good\n  Hell\n  Microsoft
L1046
)EXAMPLE
-\nbecause then a searcher for a menu entry with hints "Good,Bulky,Heaven"\nwill know to select the submenu "Good". The toplevel menu may not look\nlike\n
ACOMPACT IMPLIED
(EXAMPLE
L1051
-  Good\n  Hell\n  Heaven
L1054
)EXAMPLE
-\nas now it isn't clear whether to visit the Good or the Heaven submenu.
L1056
)P
(P
L1057
-That rule allows usually for many different trees, and the task of the\noptimization procedure is to select, in a finite amount of time, the\ntree that best matches the user's desire about the optimum number of\nmenu entries.\n
L1062
)P
)SECT
AID IMPLIED
(SECT
(HEADING
-Variables and functions in the install-menu scripts
L1063
)HEADING
(P
L1064
-\nThe supported "needs" definitions and "startmenu=", "endmenu="\nand "submenutitle=" are interpreted as follows:\n\n
ACOMPACT IMPLIED
(EXAMPLE
L1069
-String constants:\n  Anything inside double quotes ("") is interpreted as a string, and\n  is written verbatim to the output file.\n  Stuff like \\n, \\t, ... will be substituted for their C expansions \n  (But not \\0xx, currently).\n\nVariables:\n  Anything matching $[a-z,A-Z,_]* is interpreted as a variable, and\n  the corresponding definition from the menu entry is substituted.\n  \n  Special variables:\n    The following variables are treated in a special way by install-menus,\n    either because they are used for other purposes too, or because they\n    are modified by install-menus (the ones marked with a "!" are modified\n    by install-menus).\n    \n    needs:   \n             Used to determine whether the window manager supports this\n             menu entry.\n    command: \n             If this is undefined, this menu entry is taken as defining\n             a sub-menu. (this way you can specify icons of sub-menus).\n    title!:  \n             Used for sorting (see section).\n             For sub-menu entries (those with empty command), this\n             is initialised to the last part of the section.\n             Please, keep the title short (two words at maximum).\n             The title is for people who already know what programme\n             they want to start. See "longtitle" and "description" below\n             for longer descriptions.\n    sort:    \n             Used for sorting (see section). To make sure an entry is\n             at the beginning, use something with a low ASCII number,\n             like "$". For sorting at the end, use "|"\n    section!:\n             Used to determine the section of the menu entry.\n             The menu entries that have a empty $command, ie those that\n             define a submenu, have $title added to the end of $section \n             The menu entries that have a non-empty $command have their\n             $section modified to $section/$title, or $section/$sort:$title\n             if $sort is defined. The menu entries within one submenu\n             are sorted according to $section. If you want to retrieve the\n             real section name, see the $basesection variable.\n    basesection!:\n             Used to contain the *real* section name. This is useful because\n             $section will be changed to $section/$title in special cases\n             (see above). This causes a problem when you want to do\n             parent($section) because you won't get the real parent section.\n             Instead you can use $basesection, which will never contain the\n             title.\n    hotkey!: \n             Modified to reflect what install-menus thinks is the\n             most suitable hotkey for this menu entry. The hotkey=\n             in the menu entry file is taken as a suggestion, that could\n             be overwritten if there is another entry with the same hotkey=.\n             To suggest two possible hotkeys for an entry use\n             hotkey="ab", with "a" being the most preferred hotkey.\n\n  Preferred variables:\n    The following aren't special for install-menus, but it's nice \n    (read: essential) to use the same variables for the same things.\n    So, I'll suggest some here. If you want to invent new ones, please\n    do so and mail them to me so that I can include them here.\n\n    icon:    \n             The location of the iconfile for this menu entry.\n             If you don't have an iconfile, just leave out the icon=\n             in the menu entry.\n    longtitle:\n             For people that like descriptive titles (about one line)\n             It is probably best to include this in your menu entries,\n             while the window-managers don't (by default) put it in the\n             menus. That way, people who want descriptive titles can\n             turn them on, but others don't need to use them.\n    description:\n             An even longer description (about 5 lines).\n             For example, a description of the documentation in\n             the dwww generated html pages.\n\n  Suggested variables:\n    The following variables probably shouldn't appear often (or at\n    all) in the menu files supplied with packages. They are mostly\n    intended for use by local system managers. Nevertheless, it is\n    advised that all debian systems use the following variable names:    \n    \n    visible:\n             Some apps add entries to utmp the utmp file, so that\n             "who" and friends know they are running (this is\n             especially true for xterms etc). If $visible set\n             (to anything other than "" or "none"), xterms etc will\n             not write logging info to utmp. (may not work for\n             your window manager).\n    geometry:\n             For X apps, this will be the size of the (main) window\n             that will be created (units in either chars or pixels,\n             depending on type of main window (xterm or graphic)).\n             If you as package maintainer want to use this, you should\n             probably think about setting this variable somewhere\n             in an Xresources file.\n             \n\nFunctions:\n  Anything matching [a-z,A-Z,_] is taken as a function (and an error\n  is generated if the function doesn't exist). The arguments of the\n  functions can be other functions, string constants or variables.\n  \n  prefix()\n     returns the current prefix dir: either $rootprefix, or\n     $HOME/$userprefix, depending on who runs install-menu\n\n  ifroot($rootarg, $userarg)\n     if(getuid()==0) print $rootarg, else print $userarg\n\n  print($arg)    \n     Same as just $arg; if $arg is empty, generate an error.\n\n  nstring($n, $string)\n     write $string $n times. So, nstring(3,"Aa") writes "AaAaAa".\n     (Useful in combination with level()).\n\n  esc($arg1,$arg2)\n     Print $arg1, but escape all occurrences of characters in $arg2\n     with a \\. (thus, if arg1="hello", arg2="lo", print "he\\l\\l\\o").\n\n  escwith($arg1, $arg2, $arg3)\n     Same as esc, but use $arg3 as escape sequence.\n\n  escfirst($arg1, $arg2, $arg3)\n     Same as escwith, but only escapes thirst occurrence of $arg2.\n\n  cppesc($arg1)\n     Escape anything that isn't a letter, number or _ with\n     $\|[lt    ]\|hex-ascii-code\|[gt    ]\|. So, for example, a '-' is replaced by '$2D'.\n     This way, $arg1 can be used as a #define in cpp.\n\n  tolower($arg)\n  toupper($arg)\n     Returns the argument set in lowercases resp uppercases. \n\n  replacewith($s, $replace, $with)\n     Search s for occurrences of characters from string replace, and\n     replace them by the corresponding character in $with.\n     Example:\n      replacewith_string("hello $world, %dir", "$% ", "123")\n      returns:   "hello31world,32dir"\n\n  ifempty($arg1, $arg2)\n     If $arg1 is empty, print $arg2, otherwise print nothing.\n     For compatibility, $arg1="none" is interpreted as empty.\n\n  ifnempty($arg1, $arg2)     \n     If $arg1 is not empty, print $arg2.\n     For compatibility, the string "none" is seen as empty.\n\n  ifelse($arg1,$arg2,$arg3)\n     If $arg1 is non-empty, print $arg2, otherwise $arg3.\n     For compatibility, the string "none" is seen as empty.\n\n  ifeq($arg1, $arg2, $arg3)\n     If ($arg1==$arg2) then print $arg3\n  ifneq($arg1, $arg2, $arg3)\n     If ($arg1!=$arg2) then print $arg3\n  ifeqelse($arg1, $arg2, $arg3, $arg4)\n     If ($arg1==$arg2) then print $arg3 else print $arg4\n\n  cond_surr($arg1, $arg2, $arg3)\n     If $arg1 is non-empty print $arg2$arg1$arg3, otherwise print nothing.\n     For compatibility, $arg1="none" is interpreted as empty.\n\n  iffile($arg1, $arg2)\n     If file $arg1 exists, and can be opened for reading by whoever\n     started the current process, return $arg2, otherwise return nothing.\n\n\n  ifelsefile($arg1, $arg2, $arg3)\n     If file $arg1 exists, and can be opened for reading by whoever\n     started the current process, return $arg2, otherwise return $arg3.\n\n  catfile($arg1)\n     Return the contents of file $arg1.\n  \n  forall($array, "var", $exec)\n     For each element of the column separated array $array, set\n     $var to that element, and print $exec.\n     Example:\n      forall("eo:nl", "lang", " name[" $lang "]=\\"" translate($lang, title()) "\\"\\n")\n     will print:\n      name[eo]="Mi estas titolo"\n      name[nl]="Ik ben een titel"\n\n  parent($arg)\n     for $arg a "directory", return parent directory:\n     parent("/Debian/Apps/Editors") = "/Debian/Apps".\n\n  basename($arg)\n     return the last part of the parent directory:\n     basename("/Debian/Apps/Editors") = "Apps".\n\n  stripdir($arg)\n     everything after the last slash, i.e. what basename() \n     should have returned: stripdir("/Debian/Apps/Editors") = "Editors".\n\n  entrycount()\n     the number of entries in this menu.\n \n  entryindex()\n     returns relative position of this entry. Start with 0,\n     last entry is entrycount() - 1.\n     BUG: if sort= anything other than $title, then this\n     entryindex() will return incorrect values.\n\n  firstentry($arg)\n     return $arg if this is the first entry of this menu\n     (that is, entryindex() = 0). Else, return nothing.\n\n  lastentry()\n     return $arg if this is the last entry in this menu\n     (that is, entryindex() = entrycount() -1). Else, return nothing.\n     \n  level()\n     return nesting of this menu in the total menu tree.\n\n  add($arg1,$arg2)\n  sub($arg1,$arg2)\n  mult($arg1,$arg2)\n  div($arg1,$arg2)\n     returns the sum, difference, product or quotient of $arg1 and\n     $arg2. Note that the arguments are strings, that are converted\n     to integers.\n     example: mult("24", entryindex())\n     \n  rcfile() examplercfile()  mainmenutitle() rootsection() rootprefix() \n  userprefix() treewalk() postoutput() preoutput()\n     These functions all output whatever they were defined to be in\n     the menu-method file.\n\n  translate($lang, $text)\n     translate $text into $lang.\n     example:\n       translate("eo", "Apps")\n     prints:\n       Aplikoj\n\nString constants, variables and functions can be concatenated \nby placing them after each other with a space in between, like:\n\n"hello" ifelse($comma, $comma, " sorry" $period " comma not defined") " world"
L1316
)EXAMPLE
-\n  
L1318
)P
)SECT
)CHAPT
)BOOK
L1319
)DEBIANDOC
C
