#!/usr/sbin/install-menu
#I need menu-1.4!
#
#NOTE: the first line of this script _must_ be
# equal to "#!/usr/sbin/install-menu", otherwise update-menus
# will feed this script old-compat-mode data.
#
#More info: /usr/doc/menu/html.
#
# One of the great things about free software is that if someone else
# does it right, you don't have to do it again.  The following is cribbed
# from the fvwm menu-method file, mostly by Julian Gilbey

compat="menu-1"

!include menu.h

function start($var,$com)=\
            "+ \"" escfirst(title(),$hotkey,"&") \
            cond_surr(icon(),"%","%") "\" " $var " " $com "\n"
supported 
  fvwm95module=  start("Module", $command)
  wm=          start("Restart",$command)
  x11fvwm2=    start("Exec",   $command)
  x11fvwm=     start("Exec",   $command)
  x11=         start("Exec",   $command)
  text=        start("Exec",   term())
endsupported

# 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), and re-read the main-menu-pre.hooks whose results
#    we merrily blew away earlier.  This is so that the
#    main-menu-pre.hooks work for users as well as system-wide.  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 \"" $section "\"\n" \
             "AddToMenu \"" $section "\" \"" title() "\" Title \n" \
               ifeq($section, "/Debian", \
                   "Read /etc/X11/fvwm95/main-menu-pre.hook \n" \
                   "Read .fvwm95/main-menu-pre.hook \n")
endmenu=     "\n"

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

#If you want your fvwm95 sessions to be automatically restarted when you
#upgrade your debian menus, uncomment the next line:
#postrun="killall -USR1 /usr/X11R6/bin/fvwm95"
