From 5e50c50f1beaf428c686954de3336027ef917e33 Mon Sep 17 00:00:00 2001 From: Rihards Gravis Date: Tue, 18 Dec 2018 01:06:16 +0200 Subject: [PATCH 1/2] Show desktop window only after persisted state has been restored --- src/desktop/main.js | 9 +-------- src/desktop/src/index.js | 3 +++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/desktop/main.js b/src/desktop/main.js index b98986dd68..c5abb42c9d 100644 --- a/src/desktop/main.js +++ b/src/desktop/main.js @@ -105,12 +105,6 @@ function createWindow() { }); } catch (error) {} - let bgColor = (settings.theme && settings.theme.body.bg) || 'rgb(3, 41, 62)'; - - if (bgColor.indexOf('rgb') === 0) { - bgColor = bgColor.match(/[0-9]+/g).reduce((a, b) => a + (b | 256).toString(16).slice(1), '#'); - } - /** * Initialize the main wallet window */ @@ -121,12 +115,12 @@ function createWindow() { y: windowState.y, minWidth: 500, minHeight: 720, + show: false, frame: process.platform === 'linux', titleBarStyle: 'hidden', icon: `${paths.assets}icon.${ process.platform === 'win32' ? 'ico' : process.platform === 'darwin' ? 'icns' : 'png' }`, - backgroundColor: bgColor, webPreferences: { nodeIntegration: false, preload: path.resolve(paths.preload, devMode ? 'preloadDev.js' : 'preloadProd.js'), @@ -143,7 +137,6 @@ function createWindow() { fullscreenable: false, resizable: false, transparent: true, - backgroundColor: bgColor, show: false, webPreferences: { nodeIntegration: false, diff --git a/src/desktop/src/index.js b/src/desktop/src/index.js index 31bdda52d4..8db175ed98 100644 --- a/src/desktop/src/index.js +++ b/src/desktop/src/index.js @@ -65,6 +65,9 @@ const persistor = persistStore(store, persistConfig, (_, restoredState) => { ) { migrate(settings.version); } + + Electron.focus(); + }); /** From e8cfce266d7556b41b383dbcf4a373a0e594119e Mon Sep 17 00:00:00 2001 From: Rihards Gravis Date: Tue, 18 Dec 2018 01:12:48 +0200 Subject: [PATCH 2/2] Send payload only if provided --- src/desktop/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/desktop/main.js b/src/desktop/main.js index c5abb42c9d..9cf192f829 100644 --- a/src/desktop/main.js +++ b/src/desktop/main.js @@ -400,13 +400,15 @@ ipc.on('menu.update', (e, payload) => { }); /** - * Proxy focus event from tray to main window + * Proxy main window focus */ ipc.on('window.focus', (e, payload) => { if (windows.main) { windows.main.show(); windows.main.focus(); - windows.main.webContents.send('menu', payload); + if (payload) { + windows.main.webContents.send('menu', payload); + } } });