   if arg is yes
     Menu.setApplicationMenu Menu.buildFromTemplate menuTemplate()
   else
-    Menu.setApplicationMenu null
+    Menu.setApplicationMenu Menu.buildFromTemplate emptyMenuTemplate()
 
 # Quit when all windows are closed.
 app.on 'window-all-closed', ->

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

  # Don't use a menu bar.
  mainWindow.setMenu null

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


# be closed automatically when the javascript object is GCed.
mainWindow = null

emptyMenuTemplate = -> []

menuTemplate = ->
  if process.platform is 'darwin'
    [
      {
        label: 'Relief Valve'
        submenu: [
          {
            label: 'About Relief Valve'
            selector: 'orderFrontStandardAboutPanel:'
          }
        ]
      }
      {
        label: 'View'
        submenu: [
          {
            label: 'Reload'
            accelerator: 'Cmd+R'
            click: -> mainWindow.reload()
          }
          {
            label: 'Toggle DevTools'
            accelerator: 'Option+Cmd+I'
            click: -> mainWindow.toggleDevTools()
          }
        ]
      }
    ]
  else
    [
      {
        label: 'Relief Valve'
        submenu: [
          {
            label: 'About Relief Valve'
            click: -> mainWindow.webContents.send 'menuItem', 'about'
          }
        ]
      }
      {
        label: 'View'
        submenu: [
          {
            label: 'Reload'
            accelerator: 'Ctrl+R'
            click: -> mainWindow.reload()
          }
          {
            label: 'Toggle DevTools'
            accelerator: 'Shift+Ctrl+I'
            click: -> mainWindow.toggleDevTools()
          }
        ]
      }
    ]

ipc.on 'running', (event, arg) ->
  console.log "Running: #{arg}"
