     mainWindow.loadURL 'file://' + __dirname + '/ui/index.html'
     # Only show window when it has some content
     mainWindow.once 'ready-to-show', () ->
-        mainWindow.show()
+        if !global.windowHideWhileCred? || global.windowHideWhileCred != true
+            mainWindow.show()
     # short hand
 
 toggleWindowVisible = ->

    return;

# No more minimizing to tray, just close it
global.forceClose = false;
quit = ->
    global.forceClose = true;
    app.quit()
    return

app.on 'before-quit', ->
    global.forceClose = true;
    return

# For OSX show window main window if we've hidden it.


        loginWindow.on 'closed', quit

        global.windowHideWhileCred = true
        mainWindow.hide()
        loginWindow.focus()
        # reinstate app window when login finishes
