         window.addEventListener "offline", =>
             @emit "did-change-network-state", false
 
+        window.addEventListener "beforeunload", =>
+            app.config.set "nco.window.bounds", @currentWindow.getBounds()
+            return
+
         @onDidChangeNetworkState (isOnLine) =>
             if isOnLine is no
                 console.info "%cNetwork state was changed to %cOffline", Colors.text.info, Colors.text.danger

                .catch (e) =>
                    console.error e
                    callback(e)


    _loadServices : ->

        @_initializeCoreModules()
        @_handleEvents()
        @_handleCommands()
        @_restoreWindowBounds()

        Migrater.migrate()
        @_initializeNcoModules()
