             ]
         }, {
             label: 'Toggle Full Screen',
-            accelerator: acceleratorMap['togglefullscreen'][os],
+            accelerator: acceleratorMap['togglefullscreen'][platform],
             click: -> action 'togglefullscreen'
         }, {
             # seee https://github.com/atom/electron/issues/1507
             label: 'Zoom In',
-            accelerator: acceleratorMap['zoomin'][os],
+            accelerator: acceleratorMap['zoomin'][platform],
             click: -> action 'zoom', +0.25
         }, {
             label: 'Zoom Out',
-            accelerator: acceleratorMap['zoomout'][os],
+            accelerator: acceleratorMap['zoomout'][platform],
             click: -> action 'zoom', -0.25
         }, {
             label: 'Reset Zoom',
-            accelerator: acceleratorMap['resetzoom'][os],
+            accelerator: acceleratorMap['resetzoom'][platform],
             click: -> action 'zoom'
         }, {
             type: 'separator'
         }, {
             label: 'Previous Conversation',
-            accelerator: acceleratorMap['previousconversation'][os]
+            accelerator: acceleratorMap['previousconversation'][platform]
             enabled: viewstate.loggedin
             click: -> action 'selectNextConv', -1
         }, {
             label: 'Next Conversation',
-            accelerator: acceleratorMap['nextconversation'][os]
+            accelerator: acceleratorMap['nextconversation'][platform]
             enabled: viewstate.loggedin
             click: -> action 'selectNextConv', +1
         }, {

        }
    tmpl

templateWindow = (viewstate, os) -> [
    {
        label: 'Minimize'
        accelerator: acceleratorMap['minimize'][os]
        selector: 'performMiniaturize:'
    }, {
        label: 'Close'
        accelerator: acceleratorMap['close'][os]
        selector: 'performClose:'
    }, {
        type: 'separator'
    }, {
        label: 'Bring All to Front',
        selector: 'arrangeInFront:'
    }
]

templateMenu = (viewstate) ->
    os = if require('os').platform() == 'darwin' then 'darwin' else 'others'
    tmpl = [{
            label: 'YakYak'
            submenu: templateYakYak viewstate, os
        }, {
            label: 'Edit'
            submenu: templateEdit viewstate, os
        },{
            label: 'View'
            submenu: templateView viewstate, os
        }
    ]
    if os == 'darwin'
        tmpl.push {
            label: 'Window'
            submenu: templateWindow viewstate, os
        }
    tmpl

module.exports = (viewstate) ->
    Menu.setApplicationMenu Menu.buildFromTemplate templateMenu(viewstate)

            click: -> action 'toggleshowtray'
        }
    ]
    if platform == 'darwin'
        tmpl.push {
            label: 'Hide Dock icon'
            type: 'checkbox'
