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

14
main.js
View file

@ -65,6 +65,12 @@ function createWindow () {
} }
}, windowConfig); }, windowConfig);
if (windowOptions.fullscreen === false) {
delete windowOptions.fullscreen;
}
logger.info('Initializing BrowserWindow config: %s', JSON.stringify(windowOptions));
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow(windowOptions); mainWindow = new BrowserWindow(windowOptions);
@ -75,13 +81,19 @@ function createWindow () {
// so if we need to recreate the window, we have the most recent settings // so if we need to recreate the window, we have the most recent settings
windowConfig = { windowConfig = {
maximized: mainWindow.isMaximized(), maximized: mainWindow.isMaximized(),
fullscreen: mainWindow.isFullScreen(),
width: size[0], width: size[0],
height: size[1], height: size[1],
x: position[0], x: position[0],
y: position[1] 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); userConfig.set('window', windowConfig);
} }