Don't include maximize in BrowserWindow options

This commit is contained in:
Scott Nonnenberg 2019-11-14 14:01:52 -08:00
parent 6b60ca6bd7
commit df3f583dc9

23
main.js
View file

@ -234,14 +234,7 @@ function createWindow() {
}, },
icon: path.join(__dirname, 'images', 'icon_256.png'), icon: path.join(__dirname, 'images', 'icon_256.png'),
}, },
_.pick(windowConfig, [ _.pick(windowConfig, ['autoHideMenuBar', 'width', 'height', 'x', 'y'])
'maximized',
'autoHideMenuBar',
'width',
'height',
'x',
'y',
])
); );
if (!_.isNumber(windowOptions.width) || windowOptions.width < MIN_WIDTH) { if (!_.isNumber(windowOptions.width) || windowOptions.width < MIN_WIDTH) {
@ -270,10 +263,6 @@ function createWindow() {
delete windowOptions.y; delete windowOptions.y;
} }
if (windowOptions.fullscreen === false) {
delete windowOptions.fullscreen;
}
logger.info( logger.info(
'Initializing BrowserWindow config: %s', 'Initializing BrowserWindow config: %s',
JSON.stringify(windowOptions) JSON.stringify(windowOptions)
@ -284,6 +273,9 @@ function createWindow() {
if (windowOptions.maximized) { if (windowOptions.maximized) {
mainWindow.maximize(); mainWindow.maximize();
} }
if (windowOptions.fullscreen) {
mainWindow.setFullScreen(true);
}
function captureAndSaveWindowStats() { function captureAndSaveWindowStats() {
if (!mainWindow) { if (!mainWindow) {
@ -297,18 +289,13 @@ function createWindow() {
windowConfig = { windowConfig = {
maximized: mainWindow.isMaximized(), maximized: mainWindow.isMaximized(),
autoHideMenuBar: mainWindow.isMenuBarAutoHide(), autoHideMenuBar: mainWindow.isMenuBarAutoHide(),
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( logger.info(
'Updating BrowserWindow config: %s', 'Updating BrowserWindow config: %s',
JSON.stringify(windowConfig) JSON.stringify(windowConfig)