 
 mainWindow = null
 tray = null
-hasTray = process.platform != 'darwin'
 
 # No more minimizing to tray, just close it
 readyToClose = false

        "min-width": 620
        "min-height": 420
        icon: path.join __dirname, 'icons', 'icon.png'
        show: !hasTray or !nconf.get 'startminimized'
    }

    # Create the system tray
    if hasTray
        # Create tray
        tray = new Tray path.join __dirname, 'icons', 'icon.png'
        contextMenu = Menu.buildFromTemplate [
            { label: 'Hide/show', click: toggleWindowVisible }
            { label: 'Quit', click: quit}
        ]
        tray.setToolTip 'YakYak - Hangouts client'
        tray.setContextMenu contextMenu

        # Emitted when the tray icon is clicked
        tray.on 'clicked', toggleWindowVisible

    # and load the index.html of the app. this may however be yanked
    # away if we must do auth.


    ipc.on 'updatebadge', (ev, value) ->
        app.dock.setBadge(value) if app.dock
        if value > 0
            tray.setImage path.join __dirname, 'icons', 'icon-unread.png'
        else
            tray.setImage path.join __dirname, 'icons', 'icon.png'

    ipc.on 'searchentities', (ev, query, max_results) ->
        promise = client.searchentities query, max_results
