Subject: RFC: generating menus from packages
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 09/03/2002 01:21:27
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---1496233398-995426333-1031037827=:3105
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.4.43.0209030024081.3105@pilchuck.reedmedia.net>
(I previously discussed this back in January 2001.)
It would be very useful if the packages collection would support
generating useful menus for window managers.
For example, if a user installs audio/xmmix, then it would be nice if a
menu automatically (or semi-automatically) received that entry.
If a computer novice installs Abiword, it sure would be nice if Abiword
showed up in their window manager's menu automatically.
This can (should) be configurable.
I'd appreciate some feedback. I have questions below.
Attached are a few patches to help get this started.
The patches add simple support to add a MENU entry for Makefiles.
The patches are for:
pkg_install/lib/lib.h
pkg_install/lib/plist.c
mk/bsd.pkg.mk
mk/bsd.pkg.defaults.mk
To use, simply add a MENU definition for any X clients you want to try to
the corresponding Makefiles (and install). For example:
MENU= xbill:games:X:${PREFIX}/bin/xbill
MENU= xworm:games:X:${PREFIX}/bin/xworm
MENU= xmmix:audio:X:${PREFIX}/bin/xmmix
MENU= Lynx:www:Console:/usr/pkg/bin/lynx
Then write a simple script to test that generates a menu file for your
favorite window manager. (Also attached is a unfinished, but working,
script for using with blackbox.)
1) Should all menu entries be placed in single file or per package (that
supports it)? I think it should be separate files.
A single package could have several menu entries.
2) I think each menu entry should contain at least:
title (brief), category, type (console, X, window manager, daemon (no
interaction), and path to command to run.
(Currently, I am using a colon as the delimiter. Debian's menu tools uses
keywords, but that gets more difficult and I don't think is needed,
especially so normal sed, awk, sh, sort can generate the final menus.)
3) David Brownlee suggested that it identify window managers too, so each
window manager specific script can do the right thing. For example,
icewm could have:
IceWM:wm:Window Manager:/usr/X11R6/bin/icewm
(In this case the category and type are redundant.)
And then blackbox menu would be like:
[restart] (IceWM) {/usr/X11R6/bin/icewm}
instead of
[exec] ...
4) Then optionally have suggested X command to run with suggested
command-line options. For example:
Ettercap:net:Console:/usr/pkg/sbin/ettercap:${XTERM} -geometry 80x25 ...
Then something like for icewm could be generated using the suggestion:
menu "net" folder {
prog Ettercap ettercap rxvt -geometry 80x25 -e /usr/pkg/sbin/ettercap
}
(Another configuration option to use that too),
Another example:
MENU= Links:www:Console:/usr/pkg/bin/links:/usr/pkg/bin/links -g
(so it will use -g switch to be graphical.)
5) Also optional: a brief description (because some window managers may show)
and long title (because some window managers may display).
6) I originally thought that categories could have subcategories like
audio/mixers or Editors/Simple, just because if many items had menu
entries it would become quite overwhelming. But it could just simply use
our standard package categories. What do you think?
7) Each window manager could have a seperate package that has simple awk
script to generate a menu file for that specific window manager. Then if
the SUGGESTS mechanism is in use, a window manager package could suggest
that corresponding menu generator :)
The script would output a set file but not overwrite the default installed
version.
A MESSAGE could tell the admin how to include (or use) the additional menu
file. (Or just simply use it by default.)
In addition these scripts could be used by individual users by also
allowing their custom local menu entries to override any system-wide
settings.
These scripts could be placed in one location.
8) I can easily write the scripts for blackbox (which doesn't support
tooltips and wouldn't take advantage of long descriptions), icewm, and
KDE.
9) The pkg tools and pkgsrc bsd.pkg.mk could automatically update the
menu files when a new one is installed. This could be done by simply
running the menu generator script(s) above. Of course, this will be
configurable.
10) A new PLIST entry type "@menu" can be used so the pkg tools can know
about this special capability. Can anyone share suggestions?
Then pkg_add and related tools would need to know how to install or
understand the menu entry file. (Patch included lets "make install"
not complain about "Unrecognised PLIST" format and so pkg_delete will
delete menu entry file.)
11) A couple packages for base/core programs and base X programs can be
made that simply have menu entries, like for xfontsel, xclock, xterm,
etc.
12) I think the menu entries for packages should be saved in only one
place. But it would be okay if in multiple places too. Where do you think?
/var/pkg/something? /usr/X11R6/etc/package-menus/?
/usr/pkg/etc/package-menus?
13) Right now I have it add to the PLIST. (I need to make "make
print-PLIST" do the right thing.)
14) This could be used to make menus for text consoles too. But I don't
know of any and I don't think I would use any.
15) The XTERM setting is so it can do "rxvt -e command", for example if
console and generated for a X window manager. Hmmm, the XTERM setting
provided is not useful, and will probably be removed. This can be set in
extra configuration files as needed, like: /usr/pkg/etc/menus-XTERM or
~/menus-XTERM or whatever.
16) Maybe a package could contain menu info for all categories too.
Like:
net:category:Network Tools
Which would only be used if that category actually had entries.
17) Overall this will not take much code and only a little documentation.
For future pkgsrc submitters, all they would need to add (as appropriate)
a MENU setting (or multiple).
Note that I base some of these ideas on menu tools for Debian Linux
packages. This is more simple than Debian's methods, but it works just as
well or better :)
Please share your advice and suggestions.
Thank you,
Jeremy C. Reed
http://bsd.reedmedia.net/
---1496233398-995426333-1031037827=:3105
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=blackbox-menu
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.43.0209030023470.3105@pilchuck.reedmedia.net>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME=blackbox-menu
IyEvYmluL3NoDQoNCnNvcnQgLXQgJzonICsxIC91c3IvcGtnL2V0Yy9tZW51
LyogfA0KIGF3ayAtRiAnOicgJw0KICB7DQogICAgaWYgKHByZXZtZW51ICE9
ICQyKSB7DQogICAgICBpZiAocHJldm1lbnUpIHsgcHJpbnQgIltlbmRdIiB9
DQogICAgICBwcmludCAiW3N1Ym1lbnVdICgiJDIiKSINCiAgICB9DQogICAg
cHJldm1lbnU9JDI7DQogICAgaWYgKCQzID09ICJYIikgcHJpbnQgIiAgW2V4
ZWNdICgiJDEiKSB7IiQ0In0iDQogICAgaWYgKCQzID09ICJDb25zb2xlIikg
cHJpbnQgIiAgW2V4ZWNdICgiJDEiKSB7eHRlcm0gLWUgIiQ0In0iDQogIH0N
CiAgRU5EIHsgaWYgKHByZXZtZW51KSB7IHByaW50ICJbZW5kXSIgfQ0KIH0n
DQoNCg==
---1496233398-995426333-1031037827=:3105
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="plist.c.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.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CX0gZWxzZSB7DQorCQkJICAgIHdhcm54KCJjYW5ub3Qg
cmVtb3ZlIG5vbi1leGlzdGVudCBtZW51IGZpbGUgYCVzJ1xuIg0KKwkJCSAg
ICAgICAgICAgICJ0aGlzIHBhY2tpbmcgbGlzdCBpcyBpbmNvcnJlY3QgLSBp
Z25vcmluZyBkZWxldGUgcmVxdWVzdCIsIHRtcCk7DQorCQkJfQ0KKwkJCWxh
c3RfZmlsZSA9IHAtPm5hbWU7DQogCQkJYnJlYWs7DQogDQogCQljYXNlIFBM
SVNUX1VORVhFQzoNCg==
---1496233398-995426333-1031037827=:3105
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="lib.h.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.43.0209030023472.3105@pilchuck.reedmedia.net>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="lib.h.diff"
LS0tIHBrZ19pbnN0YWxsL2xpYi9saWIuaC5vcmlnCU1vbiBTZXAgIDIgMjM6
NDY6MjAgMjAwMg0KKysrIHBrZ19pbnN0YWxsL2xpYi9saWIuaAlNb24gU2Vw
ICAyIDIzOjIxOjI0IDIwMDINCkBAIC0xNDEsNyArMTQxLDggQEANCiAJUExJ
U1RfSUdOT1JFX0lOU1QsCS8qIDE1ICovDQogCVBMSVNUX09QVElPTiwJCS8q
IDE2ICovDQogCVBMSVNUX1BLR0NGTCwJCS8qIDE3ICovDQotCVBMSVNUX0JM
RERFUAkJLyogMTggKi8NCisJUExJU1RfQkxEREVQLAkJLyogMTggKi8NCisJ
UExJU1RfTUVOVQkJLyogMTkgKi8NCiB9ICAgICAgIHBsX2VudF90Ow0KIA0K
IC8qIFR5cGVzICovDQo=
---1496233398-995426333-1031037827=:3105
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="bsd.pkg.mk.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.43.0209030023473.3105@pilchuck.reedmedia.net>
Content-Description:
Content-Disposition: AT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333-1031037827=:3105
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="bsd.pkg.defaults.mk.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.43.0209030023474.3105@pilchuck.reedmedia.net>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="bsd.pkg.defaults.mk.diff"
LS0tIGJzZC5wa2cuZGVmYXVsdHMubWsub3JpZwlNb24gU2VwICAyIDE1OjEz
OjM2IDIwMDINCisrKyBic2QucGtnLmRlZmF1bHRzLm1rCU1vbiBTZXAgIDIg
MjI6MDg6MDYgMjAwMg0KQEAgLTM4Myw2ICszODMsMjUgQEANCiAjIFBvc3Np
YmxlOiBBbnkgbG9jYWwgZGlyZWN0b3J5DQogIyBEZWZhdWx0OiBub25lDQog
DQorWFRFUk0/PS91c3IvWDExUjYvYmluL3h0ZXJtDQorIyBQYXRoIHRvIFgx
MSB0ZXJtaW5hbCBlbXVsYXRvciBmb3IgcnVubmluZyBpbnRlcmFjdGl2ZSBj
b25zb2xlDQorIyBjb21tYW5kcyB1bmRlciBYMTEsIHN1Y2ggYXMgcnh2dCwg
YXRlcm0sIHd0ZXJtLCBldGVybSwgZXRjLg0KKyMgVXNlZCBmb3IgZ2VuZXJh
dGluZyBtZW51cy4NCisjIFBvc3NpYmxlOiBhbnkgREVDIFZUMTAyIHRlcm1p
bmFsIGVtdWxhdG9yIGZvciBYDQorIyBEZWZhdWx0OiAvdXNyL1gxMVI2L2Jp
bi94dGVybQ0KKw0KK01FTlVfQ09ORl9ESVI/PSR7TE9DQUxCQVNFfS9ldGMv
bWVudQ0KKyMgU3BlY2lmeSB0aGUgcGFyZW50IG9mIHRoZSBkaXJlY3Rvcnkg
Zm9yIG1lbnUgZW50cmllcyBkYXRhLA0KKyMgd2hlcmUgb25lIG1lbnUgZmls
ZSBwZXIgcGFja2FnZSAod2l0aCBhIG1lbnUgZW50cnkpIGlzIHN0b3JlZC4N
CisjIFBvc3NpYmxlOiBBbnkgdmFsaWQg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