diff options
Diffstat (limited to 'doc/menu.html/ch5.html')
-rw-r--r-- | doc/menu.html/ch5.html | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/doc/menu.html/ch5.html b/doc/menu.html/ch5.html new file mode 100644 index 0000000..78df396 --- /dev/null +++ b/doc/menu.html/ch5.html @@ -0,0 +1,226 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> + +<html> + +<head> + +<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> + +<title>Debian Menu System - What packages with menu managers should do</title> + +<link href="index.html" rel="start"> +<link href="ch4.html" rel="prev"> +<link href="ch6.html" rel="next"> +<link href="index.html#contents" rel="contents"> +<link href="index.html#copyright" rel="copyright"> +<link href="ch1.html" rel="chapter" title="1 Introduction"> +<link href="ch2.html" rel="chapter" title="2 Menu from the viewpoint of a user"> +<link href="ch3.html" rel="chapter" title="3 The menu file"> +<link href="ch4.html" rel="chapter" title="4 What packages with applications should do"> +<link href="ch5.html" rel="chapter" title="5 What packages with menu managers should do"> +<link href="ch6.html" rel="chapter" title="6 How a user can override the menus"> +<link href="ch7.html" rel="chapter" title="7 The internals of the menu package"> +<link href="ch8.html" rel="chapter" title="8 Variables and functions in the install-menu scripts"> +<link href="ch2.html#s2.1" rel="section" title="2.1 How/when do the window manager startup files get created?"> +<link href="ch2.html#s2.2" rel="section" title="2.2 Tuning of the generated window manager startup files"> +<link href="ch2.html#s2.3" rel="section" title="2.3 Optimization of menu tree: hints"> +<link href="ch3.html#s3.1" rel="section" title="3.1 Location"> +<link href="ch3.html#s3.2" rel="section" title="3.2 Syntax"> +<link href="ch3.html#s3.3" rel="section" title="3.3 The title field"> +<link href="ch3.html#s3.4" rel="section" title="3.4 The needs field"> +<link href="ch3.html#s3.5" rel="section" title="3.5 The section field"> +<link href="ch3.html#s3.6" rel="section" title="3.6 The command field"> +<link href="ch3.html#s3.7" rel="section" title="3.7 The icon field"> +<link href="ch3.html#s3.8" rel="section" title="3.8 The hints field"> +<link href="ch3.html#s3.9" rel="section" title="3.9 Entries for menu sections."> +<link href="ch3.html#s3.10" rel="section" title="3.10 Fvwm's task and title bars"> +<link href="ch4.html#s4.1" rel="section" title="4.1 Providing a menu file"> +<link href="ch4.html#s4.2" rel="section" title="4.2 Adding a hook for dpkg in your packages"> +<link href="ch6.html#s6.1" rel="section" title="6.1 Configuring the menus"> +<link href="ch6.html#s6.2" rel="section" title="6.2 Specifying that a menu entry should not be displayed"> +<link href="ch6.html#s6.3" rel="section" title="6.3 Including other files"> +<link href="ch7.html#s7.1" rel="section" title="7.1 The update-menus program"> +<link href="ch7.html#s7.2" rel="section" title="7.2 The install-menu program"> +<link href="ch7.html#s7.3" rel="section" title="7.3 The install-menu config script definitions"> +<link href="ch7.html#s7.4" rel="section" title="7.4 Hints, tree optimization"> +<link href="ch8.html#s8.1" rel="section" title="8.1 String constants"> +<link href="ch8.html#s8.2" rel="section" title="8.2 Variables"> +<link href="ch8.html#s8.3" rel="section" title="8.3 Functions"> +<link href="ch8.html#s8.2.1" rel="subsection" title="8.2.1 Special variables"> +<link href="ch8.html#s8.2.2" rel="subsection" title="8.2.2 Preferred variables"> +<link href="ch8.html#s8.2.3" rel="subsection" title="8.2.3 Suggested variables"> + +</head> + +<body> + +<p><a name="ch5"></a></p> +<hr> + +<p> +[ <a href="ch4.html">previous</a> ] +[ <a href="index.html#contents">Contents</a> ] +[ <a href="ch1.html">1</a> ] +[ <a href="ch2.html">2</a> ] +[ <a href="ch3.html">3</a> ] +[ <a href="ch4.html">4</a> ] +[ 5 ] +[ <a href="ch6.html">6</a> ] +[ <a href="ch7.html">7</a> ] +[ <a href="ch8.html">8</a> ] +[ <a href="ch6.html">next</a> ] +</p> + +<hr> + +<h1> +Debian Menu System +<br>Chapter 5 - What packages with menu managers should do +</h1> + +<hr> + +<p> +Each package containing a <em>menu manager</em> (i.e., a program that can +display a menu) should provide a script or program in +<code>/etc/menu-methods/</code> that can read the menu files. This script will +be executed by <code>update-menus</code>, which will feed the menu entries to +be installed to your script via standard input (stdin). +</p> + +<p> +The scripts in <code>/etc/menu-methods/</code> should be configuration files, +so the user can tune the behaviour of the script, and they must always include +the <code>/etc/menu-methods/menu.h</code> configuration file at the beginning +with the command <samp>!include menu.h</samp> For the same reason, scripts in +<code>/etc/menu-methods/</code> are requested to use the following configurable +functions: <samp>title()</samp> for the title (in place of +<samp>$title</samp>), <samp>icon()</samp> for the icon (in place of +<samp>$icon</samp>), <samp>term()</samp> for running <samp>text</samp> command +under <samp>X11</samp>. <samp>sections_translations()</samp> for the list of +translations of sections name available. This later one is only defined if you +<samp>!include lang.h</samp> +</p> + +<p> +Good examples for these scripts for nearly all Debian window managers are +included in the <samp>menu</samp> package in +<code>/usr/share/doc/menu/examples</code>. Note that while working on your +script, you can use the tricks described in "The internals of the menu +package", section "The update-menus program", to run just your +script, instead of having update-menus run all scripts (can save quite a lot of +time). +</p> + +<p> +This script should not be executable in the package. Instead the +<samp>postinst</samp> should add the execute bit and then run +<code>update-menus</code> (if it is executable). +</p> + +<p> +Similarly, the <code>postrm</code> script when called with option ``remove'' +should remove the execute bit and run <code>update-menus</code> (if it is +executable). +</p> + +<p> +Here is an example of such a <code>postrm</code> script using <code>sh</code>: +</p> + +<pre> + #!/bin/sh + set -e + inst=/etc/menu-methods/#PACKAGE# + case "$1" in + remove) + if [ -f $inst ]; then + chmod a-x $inst + if [ -x /usr/bin/update-menus ]; then update-menus ; fi + fi + ;; + purge) + #remove the files that install-menu creates: + rm -rf /var/lib/foo-wm/menu + ;; + upgrade);; + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 0 + ;; + esac +</pre> + +<p> +And here is a good example for a <code>postinst</code> script: +</p> + +<pre> + #!/bin/sh + set -e + inst=/etc/menu-methods/#PACKAGE# + if [ -f $inst ]; then + chmod a+x $inst + if [ -x /usr/bin/update-menus ]; then + update-menus + fi + fi +</pre> + +<p> +If you are using <code>debhelper</code>, the program +<code>dh_installmenu</code> can help you do it. +</p> + +<p> +Please, do not make your package <em>depend</em> on the menu package! The +preferred way of telling dpkg that your wm can cooperate with menu is: +</p> + +<pre> + Suggests: menu +</pre> + +<p> +Please only consider using "depends" if you feel providing reasonable +defaults for systems without <code>menu</code> will make life very difficult +for you. +</p> + +<hr> + +<p> +[ <a href="ch4.html">previous</a> ] +[ <a href="index.html#contents">Contents</a> ] +[ <a href="ch1.html">1</a> ] +[ <a href="ch2.html">2</a> ] +[ <a href="ch3.html">3</a> ] +[ <a href="ch4.html">4</a> ] +[ 5 ] +[ <a href="ch6.html">6</a> ] +[ <a href="ch7.html">7</a> ] +[ <a href="ch8.html">8</a> ] +[ <a href="ch6.html">next</a> ] +</p> + +<hr> + +<p> +Debian Menu System +</p> + +<address> +version 1.4, 10 November 2011<br> +<br> +Joost Witteveen <code><a href="mailto:joostje@debian.org">joostje@debian.org</a></code><br> +Joey Hess <code><a href="mailto:joeyh@debian.org">joeyh@debian.org</a></code><br> +Christian Schwarz <code><a href="mailto:schwarz@debian.org">schwarz@debian.org</a></code><br> +Bill Allombert <code><a href="mailto:ballombe@debian.org">ballombe@debian.org</a></code><br> +<br> +</address> +<hr> + +</body> + +</html> + |