Subject: Re: building menu datafiles
To: None <>
From: Jeremy C. Reed <>
List: tech-pkg
Date: 01/08/2001 22:28:38
On Mon, 8 Jan 2001, Jeremy C. Reed wrote:

> I want to add some routines so I can automatically generate some datafiles
> which can then later be used to create menus, for example for KDE or
> Blackbox X11 window manager, from installed packages.

Well, I am responding to my own message. I built some scripts today and
learned some lessons.

A screenshot showing some of my NetBSD packages in a X menu is at

My shell script gets the names of the packages from /var/db/pkg. Figures
out which are the executables from the corresponding PLIST (so you must
have the the pkgsrc). Gets the description from the COMMENT files. Then
for each executable it looks for the ".Sh NAME" description from the
manual page (if it exists). If there is no COMMENT, it uses the manual
page description.

The code is at

It was fun to make, but it is the wrong way to do it. It is a bad idea to
try to build a menu just from the info in /var/db/pkg.

Their are too many binaries that have no place in an X menu or too large
to be manageable (like graphics/netpbm).

> My other thought is to modify the pkg tools and pkgsrc/mk/ to
> automatically add and remove menu datafile entries. Any suggestions about
> this?

Another idea is to use the DEINSTALL and INSTALL scripts to add
entries. (But I don't think this is the easiest way.)

Either way, I believe it is best to have the package maintainers add menu
entries for their packages.

Maybe a pkg/MENU file something like:

audio xcdplayer xcdplayer "CD player for X"
www lynx "xterm -fn 6x13 -n lynx -title lynx -e lynx" "Alphanumeric display oriented World-Wide Web Client"
x11 xglobe xglobe "Displays the earth as seen from space, similar to xearth"

Categories can be defined like:

audio - - "Audio applications"
audio/mixers - - "Sound Mixers"

This MENU file could be the exact format of the real menu datafile and
simply cat it and the real file into a temp file and then sort the temp
file back to replace the real file. (By the way -- this is not the format
of my script I made today.)

> (Of course, once I have all the menu data compiled, it will be trivial to
> generate correct menu files using this information.)

I also made a quick perl script to generate a blackbox menu from my data.
It is at

> Has this been discussed before?
> Any other suggestions?

What do you all think? Is it a good idea to allow package maintainers help
create X menu entries? (I am thinking about my mother!)

   Jeremy C. Reed