diff --git a/index.js b/index.js index 112e5138..b39d8bc0 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,7 @@ app.on('ready', () => { function createWindow (fn) { const cfg = plugins.getDecoratedConfig(); - const win = new BrowserWindow({ + const browserDefaults = { width: 540, height: 380, minHeight: 190, @@ -61,7 +61,10 @@ app.on('ready', () => { // we only want to show when the prompt // is ready for user input show: process.env.HYPERTERM_DEBUG || isDev - }); + }; + const browserOptions = plugins.getDecoratedBrowserOptions(browserDefaults); + + const win = new BrowserWindow(browserOptions); windowSet.add(win); win.loadURL(url); diff --git a/plugins.js b/plugins.js index f2b16035..ff749813 100644 --- a/plugins.js +++ b/plugins.js @@ -311,3 +311,19 @@ exports.getDecoratedConfig = function () { }); return decorated; }; + +exports.getDecoratedBrowserOptions = function (defaults) { + let decorated = defaults; + modules.forEach((plugin) => { + if (plugin.decorateBrowserOptions) { + const res = plugin.decorateBrowserOptions(decorated); + if (res && 'object' === typeof res) { + decorated = res; + } else { + notify('Plugin error!', `"${plugin._name}": invalid return type for \`decorateBrowserOptions\``); + } + } + }); + return decorated; +}; +