From 05eba4b521fb94cb7f2e2ab666adad0850290af6 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 26 Jul 2016 17:37:42 -0600 Subject: [PATCH] Update shell after config change and notify the user (#405) --- app/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/index.js b/app/index.js index 6a1acd7f..6bb3d179 100644 --- a/app/index.js +++ b/app/index.js @@ -6,6 +6,7 @@ const { resolve } = require('path'); const isDev = require('electron-is-dev'); const AutoUpdater = require('./auto-updater'); const toHex = require('convert-css-color-name-to-hex'); +const notify = require('./notify'); // set up config const config = require('./config'); @@ -41,7 +42,8 @@ app.on('window-all-closed', () => { app.on('ready', () => { function createWindow (fn) { - const cfg = plugins.getDecoratedConfig(); + let cfg = plugins.getDecoratedConfig(); + const [width, height] = cfg.windowSize || [540, 380]; const browserDefaults = { @@ -70,7 +72,18 @@ app.on('ready', () => { // config changes const cfgUnsubscribe = config.subscribe(() => { + const cfg_ = plugins.getDecoratedConfig(); + win.webContents.send('config change'); + + if (cfg_.shell !== cfg.shell) { + notify( + 'Shell configuration changed!', + 'Open a new tab or window to start using the new shell' + ); + } + + cfg = cfg_; }); rpc.on('init', () => {