#!/usr/sbin/install-menu
compat="menu-1"

!include menu.h

function default($var,$com)= \
	"[Desktop Entry]\n" \
        "Type=Application\n" \
        "Exec=" $command "\n" \
        "Name=" title() "\n" \
        $var  \
        "Comment=" ifelse($longtitle,$longtitle,$title) "\n" \
        ifempty(icon(), "Icon=mime_empty\n") \
        ifnempty(icon(),"Icon=" icon() "\n")

supported
  x11=  ifelsefile($kdelnk,catfile($kdelnk),default("",$command))
  text= ifelsefile($kdelnk,catfile($kdelnk),default("Terminal=1\n",$command))
  kde= ifelsefile($kdelnk,catfile($kdelnk),default("",$command))
endsupported
genmenu= ifempty($kderemove, parent($section) "/" replacewith($title,"/ ","__") ".desktop")
startmenu=""
endmenu=""
#submenutitle=""
rootsection=""
rootprefix="/var/lib/kde/menu"
userprefix=".kde/share/applnk/Debian"
prerun="test -n \""prefix()"\" && rm -rf " prefix() "/* "
postrun="/usr/bin/kde-update-menu " prefix() ";"
#treewalk="c()"
treewalk="M"
preoutput=""
