#!/usr/bin/install-menu
#
# This file is located in /etc/menu-methods/jwm
# See "Debian Menu System" /usr/share/doc/menu/html/index.html

compat="menu-1"

!include etc/menu-methods/menu.h

outputencoding="ISO-8859-1"
genmenu="jwmrc"
rootprefix="/etc/jwm/"
userprefix="jwmrc"
treewalk="(M)"
#rcfile="system.jwmrc";
#examplercfile="system.jwmrc-menu";

function q($com)=esc($com,"\"")
#function f($com)="  \"" q(title()) "\"    f.exec  \"" q($com) " &\"\n"

function xml_escape($s) = replace(replace(replace($s, \
"&",  "&amp;"), \
">",  "&gt;"), \
"<",  "&lt;")

supported
    x11=     nstring(level(), "  ") "    <Program label=\"" xml_escape(title()) "\" confirm=\"false\">" xml_escape($command) "</Program>\n"
    text=    nstring(level(), "  ") "    <Program label=\"" xml_escape(title()) "\" confirm=\"false\">" xml_escape(term()) "</Program>\n"
#    wm=     nstring(level(), "  ") "    <Exit label=\"" xml_escape(title()) "\" confirm=\"false\">" xml_escape($command) "</Exit>\n"
endsupported

startmenu=nstring(level(), "  ") "    <Menu label=\"" q(title()) "\">\n"
endmenu=nstring(level(), "  ") "    </Menu>\n"

# submenutitle= nstring(level(), "   ") "  \"" q(title()) q($section) "\"\n"




preoutput="\
<?xml version=\"1.0\"?>\n\n\
<JWM>\n\n\ 
\
<!-- Automatically generated file.\n \
     Do not edit (see /usr/share/doc/menu/html/index.html) -->\n\n \
<!-- The root menu, must exist (onroot, labeled, label height=\"32\") -->\n\n\
\ 
<RootMenu label=\"Jwm\" height=\"0\">\n\n \ 
  <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \ 
  <Program icon=\"rxvt.xpm\" label=\"Terminal\">xterm</Program>\n\n \
  <!-- Addititional Menu attributes (height, labeled) -->\n \
  <Menu icon=\"folder.xpm\" label=\"Applications\">\n \ 
     <Program icon=\"firefox.xpm\" label=\"Firefox\">firefox</Program>\n \ 
  </Menu>\n\n \ 
"



postoutput=  "\n  \
  <Separator/>\n\n \ 
  <Restart icon=\"mini.start.xpm\" />\n \ 
  <Exit    icon=\"mini.exit.xpm\"  confirm=\"false\" />\n\
</RootMenu>\n\n \
<Group>\n \
  <Class>Gaim</Class>\n \
  <Option>sticky</Option>\n \
</Group>\n\n \
<Border>\n \
  <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
  <Width>1</Width>\n \
  <Height>15</Height>\n \
  <Foreground>black</Foreground>\n \
  <Background>#DCDAD5</Background>\n \
  <ActiveForeground>white</ActiveForeground>\n \
  <ActiveBackground>#3A4956</ActiveBackground>\n \
</Border>\n\n \
	<!-- Additional tray attributes: autohide, width, border, layer, layout -->\n \
	<Tray autohide=\"false\" x=\"0\" y=\"-1\" height=\"24\">\n \
                <!-- Additional TrayButton attribute: label -->\n \
                <TrayButton label=\"Jwm\"/>\n\n \
                <!-- Additional Pager attributes; width, height -->\n \
                <Pager/>\n\n \
                <!-- Additional TaskList attribute: maxwidth -->\n \
                <TaskList/>\n\n \
                <!-- Additional Swallow attribute: height -->\n \
                <Swallow name=\"xload\" width=\"64\">\n \
                        exec xload -nolabel -bg black -fg red -hl white\n \
                </Swallow>\n\n \
                <Clock>xclock</Clock>\n \
	</Tray>\n\n \
        <!-- Visual Styles -->\n\n \
        <BorderStyle>\n \
                <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
                <Width>1</Width>\n \
                <Height>15</Height>\n \
                <Foreground>black</Foreground>\n \
                <Background>gray90</Background>\n \
                <ActiveForeground>white</ActiveForeground>\n \
                <ActiveBackground>#4A5966</ActiveBackground>\n \
        </BorderStyle>\n\n \
        <TaskListStyle>\n \
                <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
                <ActiveForeground>white</ActiveForeground>\n \
                <ActiveBackground>#8899A6</ActiveBackground>\n \
        </TaskListStyle>\n\n \
        <!-- Additional TrayStyle attribute: insert -->\n\n \
        <TrayStyle>\n \
                <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
                <Background>gray90</Background>\n \
                <Foreground>black</Foreground>\n \
        </TrayStyle>\n\n \
        <PagerStyle>\n \
                <Outline>black</Outline>\n \
                <Foreground>gray90</Foreground>\n \
                <Background>#888888</Background>\n \
                <ActiveForeground>#8899AA</ActiveForeground>\n \
                <ActiveBackground>#3A4956</ActiveBackground>\n \
        </PagerStyle>\n\n \
        <MenuStyle>\n \
                <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
                <Foreground>black</Foreground>\n \
                <Background>gray90</Background>\n \
                <ActiveForeground>white</ActiveForeground>\n \
                <ActiveBackground>#3A4956</ActiveBackground>\n \
        </MenuStyle>\n\n \
	<ClockStyle>\n \
                 <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
        </ClockStyle>\n\n \
        <Clock>\n \
                <Program>xclock</Program>\n \
        </Clock>\n\n \
        <PopupStyle>\n \
                <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
                <Outline>black</Outline>\n \
                <Foreground>black</Foreground>\n \
                <Background>yellow</Background>\n \
        </PopupStyle>\n\n \
        <Menu>\n \
                <Font>-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*</Font>\n \
                <Foreground>black</Foreground>\n \
                <Background>#DCDAD5</Background>\n \
                <ActiveForeground>white</ActiveForeground>\n \
                <ActiveBackground>#3A4956</ActiveBackground>\n \
        </Menu>\n \
<Icons>\n \
  <IconPath>$HOME/.icons</IconPath>\n \
  <IconPath>/usr/share/fvwm95/mini-icons/</IconPath>\n \
  <IconPath>/usr/X11R6/include/X11/pixmaps</IconPath>\n \
</Icons>\n\n \
<!-- Number of virtual desktops -->\n \
<DesktopCount>4</DesktopCount>\n\n \
<StartupCommand>\n \
  xli -onroot /usr/share/backgrounds/default.jpg\n \
</StartupCommand>\n\n \
<!-- Double click speed (in milliseconds) -->\n \
<DoubleClickSpeed>400</DoubleClickSpeed>\n\n \
<!-- Double click delta (in pixels) -->\n \
<DoubleClickDelta>2</DoubleClickDelta>\n\n \
<!-- The focus model (sloppy or click) -->\n \
<FocusModel>sloppy</FocusModel>\n\n \
<!-- The snap mode (none, screen, or border) -->\n \
<SnapMode distance=\"2\">border</SnapMode>\n\n \
<!-- The move mode (outline or opaque) -->\n \
<MoveMode>opaque</MoveMode>\n\n \
<!-- The resize mode (outline or opaque) -->\n \
<ResizeMode>opaque</ResizeMode>\n\n \
<!-- Key bindings -->\n \
<Key key=\"Up\">up</Key>\n \
<Key key=\"Down\">down</Key>\n \
<Key key=\"Right\">right</Key>\n \
<Key key=\"Left\">left</Key>\n \
<Key key=\"Return\">select</Key>\n \
<Key key=\"Escape\">escape</Key>\n\n \
<Key mask=\"A\" key=\"Tab\">next</Key>\n \
<Key mask=\"A\" key=\"F4\">close</Key>\n \
<Key mask=\"A\" key=\"#\">desktop#</Key>\n \
<Key mask=\"A\" key=\"F1\">root</Key>\n \
<Key mask=\"A\" key=\"F2\">window</Key>\n\n\
</JWM>\n\
"
