<?xml version="1.0"?>

<JWM>

   <!-- The root menu, if this is undefined you will not get a menu. -->
   <!-- Additional RootMenu attributes: onroot, labeled, label -->
   <RootMenu height="15" onroot="123" label="Tools">
		<Include>$HOME/jwm-local</Include>
		<Include>$JWM_BASEDIR/jwm-local</Include>
		
    	<Program icon="terminal.png" label="xterm">${XTERM_BINARY} -tn Terminal -geometry 90x25 -sb </Program> 
    	<Program icon="terminal.png" label="xterm / bash ">${XTERM_BINARY} -geometry 90x25 -tn bash -sb -e bash</Program> 
		<Program icon="terminal.png" label="hostscope">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn hostscope -e bash -e ${HOSTSCOPE_SCRIPT} -l ${TMPDIR}/hostscope.$$.log -L </Program>
		<Program icon="terminal.png" label="htop">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 150x25 -tn htop -e htop</Program>
		<Program icon="terminal.png" label="top">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn top -e top</Program>
		<Program icon="terminal.png" label="nmon">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn nmon -e nmon</Program>
		<Program icon="terminal.png" label="JWM session">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn JWM -e ${JWM_BASEDIR}/scripts/jwm_session</Program>

		<Separator/>
		<Program icon="terminal.png" label="mpstat -P ALL -u 1">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 130x$( mpstat -P ALL -u | wc -l ) -tn  "mpstat" -e mpstat -P ALL -u 1 </Program>


		<Program icon="terminal.png" label="iftop">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 130x25 -tn  "iftop" -e iftop -i $( netstat -rn | grep "^0.0.0.0" | awk '{ print $NF};' )</Program>
		<Program icon="terminal.png" label="ifstat">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry $( STR=$( bin/ifstat 1 1 | tail -1 ) ; (( i= ${#STR}+2 )) ; echo $i )x25 -tn "ifstat" -e ifstat</Program>
		<Program icon="terminal.png" label="iostat -xNz 1">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry $( S=$( iostat -xNz | tail -2 ); (( i=${#S}+4 )) ; echo $i )x$( iostat | wc -l ) -tn "iostat" -e iostat -xNz 1</Program>
		<Program icon="terminal.png" label="iostat 1 ">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry $( S=$( iostat | tail -2 ); (( i=${#S}+2 )) ; echo $i )x$( iostat | wc -l ) -tn "iostat" -e iostat 1</Program>
		<Program icon="terminal.png" label="vmstat -t 1">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 130x25 -tn "vmstat" -e vmstat -t 1</Program>
		<Program icon="terminal.png" label="pidstat 1">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 130x25 -tn "pidstat" -e pidstat 1</Program>
		<Program icon="terminal.png" label="sar -n DEV 1">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry $( S=$( sar -n DEV 1 1 | head -1 ) ; (( i = ${#S}  )); echo $i )x25 -tn "sar -n DEV 1" -e sar -n DEV 1 </Program>
		<Program icon="terminal.png" label="sar -n TCP,ETCP 1">${XTERM_BINARY} ${XTERM_OPTIONS} -geometry $( S=$( sar -n TCP,ETCP 1 1 | head -1 ) ; (( i = ${#S}  )); echo $i )x25 -tn "sar -n TCP,ETCP 1" -e sar -n TCP,ETCP 1 </Program>
		
		<Separator/>

		<Menu icon="system.png" label="JWM Desktop">
			<Desktops/>
	        <Kill/>
			<Separator/>

   			<Restart icon="exit.png" label="Restart Window Manager"/>
			<Exit label="Exit" confirm="true" icon="exit.png"/>  
		</Menu>

	</RootMenu>

	<IconPath>
		$JWM_BASEDIR/pixmaps/
	 </IconPath>

	<!-- Virtual Desktops -->
	<!-- Desktop tags can be contained within Desktops for desktop names. -->
	<Desktops count="8">
		<Background type="tile">$JWM_BASEDIR/pixmaps/bg.png</Background>
	</Desktops>
	<!-- <StartupCommand>xkbd</StartupCommand>   -->
	<!-- <ShutdownCommand></ShutdownCommand>   --> 

	<Include>$JWM_BASEDIR/etc/jwm/jwm-theme</Include>

	<Tray  x="0" y="-1" height="28">

		<!-- Additional TrayButton attribute: label -->
		<TrayButton popup="Menu Options" label="JWM">root:1</TrayButton>
		<TrayButton popup="Show Desktop" icon="systemtray.png">showdesktop</TrayButton>
		<TrayButton popup="Terminal" icon="terminal.png">exec:${XTERM_BINARY} ${XTERM_OPTIONS} -tn xerm -geometry 90x25 -sb</TrayButton>
		<TrayButton popup="bash" icon="terminal.png">exec:${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn bash -e bash</TrayButton>
		<TrayButton popup="hostscope" icon="terminal.png">exec:${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn hostscope -e bash -e ${HOSTSCOPE_SCRIPT} -l ${TMPDIR}/hostscope.$$.log -L</TrayButton>
		<TrayButton popup="top" icon="terminal.png">exec:${XTERM_BINARY} ${XTERM_OPTIONS} -geometry 90x25 -tn top -e top</TrayButton>

		<!-- Additional Pager attributes; width, height -->
		<Pager/>

		<!-- Additional TaskList attribute: maxwidth -->
		<TaskList/>

		<Dock/>

		<!-- Additional Swallow attribute: height --> 
		<!--      <Swallow name="xload" width="64">
         xload -nolabel -bg gray90 -fg blue -hl grey
		</Swallow> 
		-->
		
		<Clock>xclock</Clock>
   </Tray>

   <!-- Double click speed (in milliseconds) -->
   <DoubleClickSpeed>400</DoubleClickSpeed>

   <!-- Double click delta (in pixels) -->
   <DoubleClickDelta>2</DoubleClickDelta>

   <!-- The focus model (sloppy or click) -->
   <FocusModel>click</FocusModel>

   <!-- The snap mode (none, screen, or border) -->
   <SnapMode distance="10">border</SnapMode>

   <!-- The move mode (outline or opaque) -->
   <MoveMode>opaque</MoveMode>

   <!-- The resize mode (outline or opaque) -->
   <ResizeMode>opaque</ResizeMode>

   <!-- Key bindings -->                                                                                      
   <Key key="Up">up</Key>                                                                                     
   <Key key="Down">down</Key>                                                                                 
   <Key key="Right">right</Key>                                                                               
   <Key key="Left">left</Key>                                                                                 
   <Key key="h">left</Key>                                                                                    
   <Key key="j">down</Key>                                                                                    
   <Key key="k">up</Key>                                                                                      
   <Key key="l">right</Key>                                                                                   
   <Key key="Return">select</Key>                                                                             
   <Key key="Escape">escape</Key>                                                                             
   <Key mask="A" key="Tab">nextstacked</Key>                                                                  
   <Key mask="A" key="F4">close</Key>                                                                         
   <Key mask="A" key="#">desktop#</Key>                                                                       
   <Key mask="A" key="F1">root:1</Key>                                                                        
   <Key mask="A" key="F2">window</Key>         

</JWM>
