#!/usr/bin/install-menu
#
# Generates Window Maker menus for all registered applications.

!include menu.h
compat="menu-1";
outputencoding="UTF-8"
outputlanguage="C"

genmenu="menu.hook"
rootprefix="/etc/GNUstep/Defaults"
userprefix=shell("echo -n /${GNUSTEP_USER_ROOT-GNUstep}") "/Library/WindowMaker/"
treewalk="(M)"
rootsection="/Debian"

function mytitle()=replacewith(title(),"\"","'")

function exec($action,$com)= \
        "  \"" translate(,mytitle()) "\" " ifnempty($shortcut, "SHORTCUT " $shortcut " ") $action " " esc($com,"*") "\n"

supported
x11=	exec("SHEXEC",$command) 
wm=	exec("RESTART",$command) 
text=	exec("SHEXEC",term())
wmaker= exec("",$command ifnempty($arg," " $arg))
endsupported

preoutput= "/* Automatically generated file. Do not edit (see /usr/share/doc/menu/menu.txt.gz) */\n\n#include \"wmmacros\"\n"

mainmenutitle=""
submenutitle= ""

startmenu= "\n" \
           ifelse( \
                title(), \
                ifneq(mytitle(), "Applications", "\"" translate(,mytitle()) "\" MENU"), \
                "Debian MENU\n\n" \
           ) \
           "\n"
endmenu=   ifelse( \
                title(), \
                ifneq(mytitle(), "Applications", "\"" translate(,mytitle()) "\" END"), \
                "\n\nDebian END" \
           ) \
           "\n"
