Re-enable fullscreen on OSX (#1525)

* Re-enable fullscreen on OSX

We were inadvertantly disabling the fullscreen button due to a quick of the
BrowserWindow api. Add some guards to make sure we no longer save or use a
previously-stored `fullscreen: false` in our window configs.

// FREEBIE

* Use logger.info instead of console.log

Note the use of stringify to make config object safe for bunyan
https://github.com/trentm/node-bunyan#log-method-api

// FREEBIE
This commit is contained in:
Lilia 2017-10-03 20:07:40 +02:00 committed by Scott Nonnenberg
parent 3c45e9c350
commit 23700e1776
1 changed files with 13 additions and 1 deletions

14
main.js
View File

@ -65,6 +65,12 @@ function createWindow () {
}
}, windowConfig);
if (windowOptions.fullscreen === false) {
delete windowOptions.fullscreen;
}
logger.info('Initializing BrowserWindow config: %s', JSON.stringify(windowOptions));
// Create the browser window.
mainWindow = new BrowserWindow(windowOptions);
@ -75,13 +81,19 @@ function createWindow () {
// so if we need to recreate the window, we have the most recent settings
windowConfig = {
maximized: mainWindow.isMaximized(),
fullscreen: mainWindow.isFullScreen(),
width: size[0],
height: size[1],
x: position[0],
y: position[1]
};
if (mainWindow.isFullScreen()) {
// Only include this property if true, because when explicitly set to
// false the fullscreen button will be disabled on osx
windowConfig.fullscreen = true;
}
logger.info('Updating BrowserWindow config: %s', JSON.stringify(windowConfig));
userConfig.set('window', windowConfig);
}