[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ next ]

Debian Menu System
Chapter 3 - What packages with applications should do


3.1 Registering your applications

A package should provide a menu file /usr/lib/menu/<package-name> that contains information about each program it likes to make available in the menus.

Here is an example to describe the syntax of such a file:

     ?package(gnuplot):\           specifies what packages need to be installed
                                   multiple requirements should be seperated by
                                   comma
       needs=text\                 what kind of terminal this command expects
                                   needs=X11: if this program runs only on X11
                                   needs=text: if it only runs on text terminals
                                             (the window manager should spawn 
                                              an xterm or rxvt in this case)
                                   needs=vc: runs only at linux console
                                   needs=wm: this starts another window manager
       section=Apps/Math\          in what section this menu entry should be
       title="Gnuplot"\            the title of the menu entry (try to make it short)
                                   the title must be unique; two entries must not
                                   have the same title
       command="/usr/bin/gnuplot"  the command to run.

A program like gnuplot which can be run on X11 as well as on a text terminal should not have an extra entry with needs=X11 because it will then be next to impossible to configure the window managers to spawn rxvt instead of the default xterm.

On the other hand, if a program (like emacs) can be run as real X application as well as in a terminal, two entries should be listed, otherwise the program will always be run in an xterm (or rxvt). Though you must remember, that two entries are never allowed to have the same title. The title must be unique.

In the menu entry files, you can use "#" as comment (like in shell scripts).

You should add a line like this to your postinst script

      if test -x /usr/bin/update-menus; then update-menus; fi

and the postrm script should get the line

      if test -x /usr/bin/update-menus; then update-menus; fi

(that is, the same line in postinst and in postrm).


3.2 Preferred menu structure

The authoritative list of Debian's menu structure is maintained in the Debian Menu sub-policy document which is part of the Debian Policy package.

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 send a wishlist bug to the menu package.

Please do not put your packages into any other sections.

            Apps            - normal apps
              Databases     - interactive database programs
              Editors       - text editors, word processors
              Emulators     - dosemu, etc.
              Graphics      - image manipulation
              Hamradio      - anything relating to ham radio.
              Math          - gnuplot, octave, oleo, etc.
              Net           - mail, news, web, irc, etc.
              Programming   - debuggers, etc.
              Science       - scientific programs
              Tools         - other tools: xclock, xmag, xman, etc.
              Technical     - technical stuff.
              Text          - text oriented tools other than editors.
              Shells        - bash, ksh, zsh, etc.
              Sound         - sound players and editors
              Viewers       - image viewers
              System        - system administration and monitoring tools
            Games           - games and recreations
              Adventure     - walk around virtual space, zork, MOO's, etc
              Arcade        - any game where reflexes count
              Board         - like gnuchess, pente, gnugo
              Card          - solitaire, etc
              Puzzles       - Stuff from xpuzzles, ...
              Sports        - Games derived from "real world" sports
              Strategy      - games involving long term strategic thinking
              Tetris-like   - games involving falling blocks
              Toys          - oneko, xeyes, etc.
            Help            - programs that provide user documentation
            Screen          - programs that affect the whole screen 
              Lock          - xlock, etc.
              Save          - screen savers
              Root-window   - things that fill the root window
            WindowManagers  - X window managers 
              Modules       - window manager modules
            XShells         - shells (like xterm, rxvt, ...)

For users wanting to access some menu entries quickly, you can also put entries in the root menu. This is done by using section="/". Package provided menu entries must never use this feature.


3.3 Hints

Hints have been added starting from version 2.0.0 of menu. There needs to be some discussion about them first, but if you want to try them out, simply add a hints="Myhint,Herhint,Hishint" definition to the menu entry file. For example:

     ?package(emacs20):\
       needs="x11"\
       hints="Big,Expert,Featureful" \
       section="Apps/Editors"\
       title="Emacs 20"\
       command="/usr/bin/emacs20"\
       icon=/usr/share/emacs/20.3/etc/emacs.xbm

The above hints will case menu to consider grouping emacs together with other editors that are marked similar. For example, if vi on your system has a hints="Small,Expert" definition, and there are too many entries in the /Apps/Editors menuentry, then menu will consider creating a /Apps/Editors/Expert submenu, and put both vi and emacs in it. (of course, only if you have hint_optimize=true in your /etc/menu-methods/menu.h file).


3.4 Icons

Please, make sure the icons you specify are always available on the system. So, if you want to have an icon with your menu entry, the preferred method is to supply the icon with that package. Also, to prevent the distribution of icons files to turn too much into a mess, please put all icon files in the directory /usr/share/pixmaps.

Debian package maintainers should ensure that any icons they include for use in the debian menus conform to the following points:

  1. The icons should be in xpm format.
  1. The icons may not be larger than 32x32 pixels, although smaller sizes are ok.
  1. The background area of the icon should be transparent, if possible.

You can provide both 16x16 and 32x32 pixels icons using the variables icon16x16 and icon32x32 so that the user can configure menu to use one or the other.

If you, as a system administrator, don't like the icons in the menus, simply change the icon() function from the file /etc/menu-methods/menu.h, and run update-menus.

It's also possible to specify an icon for a sub-menu. However, if each package would supply its own icons for the sub menus we can never be sure that the icon files are available. Thus, only the menu package is allowed to specify icons for sub menus. The syntax for this is:

       X11 Apps menu/apps /usr/share/pixmaps/icon.xpm "Editors"

3.5 Fvwm's task and title bars

The problem with the stuff in the task bar is that all items are displayed all of the time. So, if 1500 debian packages all were to register a button, the buttons would quickly fill the screen, making the exercise useless. The few applications that are considered important enough to be listed in the task bar usually vary widely on each system, making it impossible to select a ``happy few'' apps that are allowed there on every debian system. If you (as a local system administrator) want your fvwm2 to have a few buttons, you can install files for those packages in /menu/$package, containing a menu entry like this:

       ?Package(xmball):needs=button\
                     section=Games/Puzzles\
                     icon=path-to-pixmap.xpm\
                     title="Xmball"\
                     command=/usr/games/xmball

Then, do the following:

       cd /etc/menu-methods/
       cp fvwm2 fvwm2button
       vi fvwm2button

and remove all the "supported" entries, adding the one below. For the rest, leave everything the same except those listed below.

       supported 
         button="+ Style \"" $title "\" TitleIcon" $icon " Exec "  $command "\n"
       endsupported
       startmenu:   "AddToTitlebar \n"
       endmenu:     "\n"
       submenutitle:""
       mainmenu:
       genmenu:   "buttondefs.hook"

(Of course regular users (not system administrators) can also specify `buttonfiles' in their ~/.menu/ directory).


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ next ]

Debian Menu System

version 1.3, 22 mai 2003

Joost Witteveen joostje@debian.org
Joey Hess joeyh@debian.org
Christian Schwarz schwarz@debian.org