#!/usr/sbin/install-menu
#
# Generates fluxbox menus for all registered applications.
#
compat="menu-1"

!include menu.h

compat="menu-2"

function findIcon($name) =
 ifneq(stripdir(locate_icon("16", $name)),
  "altlinux.png",
  ifneq(stripdir(locate_icon("16", $name)),
    "default_section.png",
    " <" locate_icon("16", $name) ">"));

function X11Command() =
 nstring(level(), "   ") "[exec] (" esc(title(), ")") ") {" $command "}" findIcon($icon) "\n";

function embededCommand() =
 nstring(level(), "   ") "[" $command "] (" translate(lang(), title()) ")\n";

function textCommand() =
 nstring(level(), "   ") "[exec] (" esc(title(), ")") ") {" term() "}" findIcon($icon) "\n";

function BeginSection() =
    ifelse($basesection,
        ifempty($command,
            nstring(level(), "  ") "[submenu] (" translate(lang(), title()) ")" findIcon($icon) "\n"),
        "\n[begin] (ALT Linux)\n[include] (~/.fluxbox/usermenu)\n");

function EndSection() =
    ifelse($basesection,
        nstring(level(), "  ") "[end]\n",
        "[end]\n");

genmenu = "menu";
rootprefix = "/etc/X11/fluxbox";
userprefix = ".fluxbox";
treewalk = "(M)";
sort = ifelse(ifelse($command, "1", "0"), $sort, title());

supported;
    x11 = X11Command();
    text = textCommand();
    fluxbox = ifelse($fluxcommand, X11Command(), embededCommand());
    wm = nstring(level(), "   ") "[restart] (" title() ") {" $command "}\n";
endsupported;

startmenu = BeginSection();
submenutitle = "";
endmenu = EndSection();

preoutput = "#\n# Generated by update-menus\n#\n# Start ALTLinux menu for Fluxbox\n#\n";
postoutput = "\n#\n# End ALTLinux menu\n#\n";
