#!/usr/sbin/install-menu
#I need menu-1.4!
# arch-tag: 73ccd6e4-fcf8-4b3f-8672-f61ae101cab5

compat="menu-1"

!include menu.h
!include lang.h

outputencoding="LOCALE"

function start($var,$com)=\
            "+ \"" escfirst(esc(title(),"\\\""),$hotkey,"&") \
            cond_surr(icon(),"%","%") "\" " $var " " $com "\n"

supported 
  fvwmmodule=  start("Module", $command)
  fvwmother=   start("",       $command)
  wm=          start("Restart",$command)
  x11fvwm2=    start("Exec exec",   $command)
  x11fvwm=     start("Exec exec",   $command)
  x11=         start("Exec exec",   $command)
  text=        start("Exec exec",   term())
endsupported

# Usage:
#   Read /etc/X11/fvwm/menudefs.hook
#   Popup /Debian

# Ok, "startmenu" is a little wacky, and comes in 4 parts:
# 1. If this is running for a user, then we do a DestroyMenu to clear
#    out the system one. Furthermore, if we're dealing with the
#    top-level /Debian menu, then add a title for it (normally done in
#    system.fvwm2rc).  Of course, none of this happens if we're
#    running as root to produce the system-wide menudef.hook file.
# 2. We spit out an "AddToMenu /Foo/Bar/Baz" to start this menu.
# 3. We add a trailing newline to the lot.

startmenu=   "DestroyMenu \"" replacewith($section," ","_") "\"\n" \
             "AddToMenu   \"" replacewith($section," ","_") "\" \"" \
                 title() "\" Title Top\n"
endmenu=     "\n"

submenutitle= "+ \"" escfirst(title(),$hotkey,"&") \
           cond_surr(icon(),"%","%") "\" Popup \"" \
           replacewith($section," ","_") "\"\n"
genmenu=   "menudefs.hook"
rootprefix="/etc/X11/fvwm/"
userprefix="/.fvwm/"
treewalk="c(m)"
mainmenutitle = "Debian Menu"
