#!/usr/sbin/install-menu
# freedesktop menu spec - menu generation
# http://www.freedesktop.org/Standards/menu-spec
# Also used as /etc/menu-methods/kicker
# Copyright 2004 - Chris Cheney <ccheney@debian.org>
# Licensed under the GNU General Public License, version 2.

compat="menu-1"

!include menu.h

compat="menu-2"

function TopDirs() =
	ifempty($section,
	"<KDELegacyDirs/>\n"
	"<DefaultAppDirs/>\n"
	"<DefaultDirectoryDirs/>\n"
	);

function BottomDirs() =
	ifempty($section,
	"<DefaultMergeDirs/>\n"
	"<MergeFile>applications-menueditor.menu</MergeFile>\n");

function DirEntry() =
	TopDirs()
	"<Name>" title() "</Name>\n"
	"<Directory>" "kde" replacewith(tolower($section),"/ ","-") ".directory" "</Directory>\n"
	"<Include>\n"
	"<Category>" "X-ALT" replacewith($section,"/ .","-") "</Category>\n"
	"</Include>\n"
	BottomDirs();

#outputencoding="UTF-8";

supported;
 kde = ;
 x11 = ;
 text = ;
endsupported;

startmenu = "\n<Menu>\n" DirEntry();
endmenu = "</Menu>\n";
submenutitle = "";

treewalk = "(M)";

rootsection = "";

genmenu = "applications-kde.menu.new";

prerun = "rm -f " prefix()"/applications-kde.menu.new";
postrun = "mv -f " prefix() "/applications-kde.menu.new " prefix() "/applications-kde.menu";

preoutput = "<!DOCTYPE Menu PUBLIC \"-//freedesktop//DTD Menu 1.0//EN\"\n \"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd\">\n<!-- Automatically generated do not edit -->\n";
postoutput = "";

rootprefix = "/etc/xdg/menus-alt";
userprefix = ".config/menus-alt";

