From 23700e1776a2d145c2144875426b160f7660d3a9 Mon Sep 17 00:00:00 2001 From: Lilia Date: Tue, 3 Oct 2017 20:07:40 +0200 Subject: [PATCH] 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 --- main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 55d2f86d0..33945d66f 100644 --- a/main.js +++ b/main.js @@ -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); }