On Tue, Sep 21, 2010 at 11:24 AM, Brad Jorsch <[email protected]> wrote:
> > This was discussed a few months ago too, see the thread starting at > http://lists.windowmaker.info/dev/msg01337.html thanks for the link. some comments on that: "util/wm-oldmenu2new is there since about '98" which means it's so old, it already have a nasty case of bit-rot. I tried it, and it choked. the perl part in it is so obfuscated, i gave up trying to update it. "in this arena, i would kill this thing altogether, then embrace and extend carlos' wmgenmenu idea. it needs to be extended a bit so you can specify app labels in a gettextable way" not only that, but it needs to be able to get an input in some way (preferably stdin) and generate the menu from there, otherwise i don't think it'll be all that usefull for distros. what makes debian's menu system good, is that it keeps stuff in a window manager-agnostic format, that can be processed for the many out there. so, until wmgenmenu fits into this, i think providing a script compatible with update-menus would fit better with debian. > > Are you managing to keep the appearance.menu stuff that uses OPEN_MENU > and cpp? the appearance.menu is generated by a separate method, i haven't touched on that part yet. what my script does is process the input and spill out a "("Appearance", OPEN_MENU, "appearance.menu")" as it shows up. now, i've been checking the changes file on the debian package. theres reference there to a wmakerpl menu-method, which makes me think a scipt to produce a proplist existed in the past but was droped. probably it didn't work as well as mine ;-) Anyway, follows the patch with the new method. to see what it does, try an "update-menus --stdout". the output of that is what my script receives on stdin. documentation on the script language is here: http://alioth.debian.org/docman/view.php/30046/2/menu-one-file.html if you want to test it, without overwriting your current menu, change the variable "genmenu" to something else, then feed the output of "update-menus --stdout" to the scripts stdin. Signed-off-by: Bento Loewenstein <[email protected]> --- debian/rules | 2 + debian/wmaker.postinst | 2 +- debian/wmaker.postrm | 2 +- debian/wmakerpl.menu-method | 75 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 debian/wmakerpl.menu-method diff --git a/debian/rules b/debian/rules index b59ad6d..d609a7f 100755 --- a/debian/rules +++ b/debian/rules @@ -161,6 +161,8 @@ binary-arch: build dh_installmenu -a --noscripts $(install_prog) debian/appearance.menu-method \ $(DEBTMPDIR)/etc/menu-methods/wmappearance + $(install_prog) debian/wmakerpl.menu-method \ + $(DEBTMPDIR)/etc/menu-methods/wmakerpl $(install_file) WindowMaker/appearance.menu \ $(DEBTMPDIR)/$(WMCONFDIR)/ $(install_file) WindowMaker/background.menu \ diff --git a/debian/wmaker.postinst b/debian/wmaker.postinst index 76b9c30..e1f6e14 100644 --- a/debian/wmaker.postinst +++ b/debian/wmaker.postinst @@ -4,7 +4,7 @@ # # Marcelo Magallon <[email protected]> -inst="/etc/menu-methods/wmaker /etc/menu-methods/wmappearance" +inst="/etc/menu-methods/wmaker /etc/menu-methods/wmappearance /etc/menu-methods/wmakerpl" x_wm_link=/etc/alternatives/x-window-manager x_wm_man_link=/usr/share/man/man1/x-window-manager.1.gz diff --git a/debian/wmaker.postrm b/debian/wmaker.postrm index 85ac7e1..a5e8348 100644 --- a/debian/wmaker.postrm +++ b/debian/wmaker.postrm @@ -2,7 +2,7 @@ set -e -inst="/etc/menu-methods/wmaker /etc/menu-methods/wmappearance" +inst="/etc/menu-methods/wmaker /etc/menu-methods/wmaker /etc/menu-methods/wmappearance" asclock="/usr/X11R6/bin/asclock" asclock_diversion="/usr/X11R6/bin/asclock.afterstep" asclock_man="/usr/X11R6/man/man1/asclock.1x.gz" diff --git a/debian/wmakerpl.menu-method b/debian/wmakerpl.menu-method new file mode 100644 index 0000000..4dbbb3b --- /dev/null +++ b/debian/wmakerpl.menu-method @@ -0,0 +1,75 @@ +#!/usr/bin/install-menu +# +# Generates Window Maker menus for all registered applications. + +!include menu.h +compat="menu-1"; +outputencoding="UTF-8" + +genmenu="WMRootMenu" +rootprefix="/etc/X11/WindowMaker/" +userprefix=shell("echo -n /${GNUSTEP_USER_ROOT-GNUstep}") "/Defaults/" +treewalk="(M)" +rootsection="/Debian" + +#workaround for a nasty bug that makes install-menu miscount the entries. +#this is critical for proper placement of commas in a wmaker proplist. +#basically this forces commands on top, before submenus +#if we don't do this and the last entry is a command there'll be an extra comma +#when it shouldn't + +sort=ifelse($command, "0", "1")":"$title + +function mytitle()=replacewith(title(),"\"","'") + +# Proplist menus are finicky. the items need to be comma separated +# but the last item can't have a coma before the next closing parethesis +# so we test for "last entry" all. the. time. + +function exec($action,$com)= \ + " (\"" mytitle() "\", " ifnempty($shortcut, "SHORTCUT, \"" $shortcut "\", ") \ + ifnempty($action, $action ", ") \ + "\"" esc($com,"*\"") "\"" \ + ifelse(lastentry("1"),")","),") \ + "\n" +# because of differences in the number of fields and proper usage o quotes +# we can't use exec() to create items that needs="wmaker" +# unfortunately some debian dockapp packages are tagged with need="wmaker" +# pclock is one. this is obviously wrong, only internal commands should +# need wmaker. so this kludge takes this into account + +function exec($com,$action)= \ + " (\"" mytitle() "\", " ifnempty($shortcut, "SHORTCUT, \"" $shortcut "\", ") \ + ifelse(parent($com), "EXEC, \"" $com "\"", $com ) \ + ifnempty($action, ", \"" esc($action,"*\"") "\"") \ + ifelse(lastentry("1"),")","),") \ + "\n" +supported +x11= exec("EXEC",$command) +wm= exec("RESTART",$command) +text= exec("SHEXEC",term()) +wmaker= exec($command, ifnempty($arg, $arg)) +endsupported + +preoutput= "" + +mainmenutitle="" +submenutitle= "" + +startmenu= ifelse( \ + title(), \ + " (\"" mytitle() "\",", \ + "(Debian,\n" \ + ) \ + "\n" + +endmenu= ifelse( \ + title(), \ + ifelse( \ + lastentry("1"), \ + ")" , \ + ")," \ + ), \ + "\n)" \ + ) \ + "\n" -- 1.7.0.4 -- To unsubscribe, send mail to [email protected].
