 # be closed automatically when the javascript object is GCed.
 mainWindow = null
 
-emptyMenuTemplate = -> []
+noMenu = ->
+  if process.platform is 'darwin'
+    Menu.buildFromTemplate [
+      {
+        label: 'Relief Valve'
+        submenu: [
+          {
+            label: 'About Relief Valve'
+            selector: 'orderFrontStandardAboutPanel:'
+          }
+        ]
+      }
+    ]
+  else
+    null
 
-menuTemplate = ->
+fullMenu = ->
   if process.platform is 'darwin'
-    [
+    Menu.buildFromTemplate [
       {
         label: 'Relief Valve'
         submenu: [

  mainWindow = new BrowserWindow width: 800, height: 600, show: false

  # Don't use a menu bar.
  Menu.setApplicationMenu Menu.buildFromTemplate emptyMenuTemplate()

  url = "file://#{__dirname}/index.html"


ipc.on 'showMenu', (event, arg) ->
  console.log "Menu: #{arg}"
  if arg is yes
    Menu.setApplicationMenu fullMenu()
  else
    Menu.setApplicationMenu noMenu()

# Quit when all windows are closed.
app.on 'window-all-closed', ->
