diff --git a/src/main/index.js b/src/main/index.js index ab0b59075b4dd..27f4e4d0290cb 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -256,7 +256,13 @@ function runApp() { // Someone tried to run a second instance, we should focus our window if (mainWindow && typeof commandLine !== 'undefined') { if (mainWindow.isMinimized()) mainWindow.restore() - mainWindow.focus() + process.platform === 'darwin' ? app.focus({ steal: true }) : app.focus() + mainWindow.setAlwaysOnTop(true) + mainWindow.show() + setTimeout(function() { mainWindow.focus() }, 100) + mainWindow.moveTop() + process.platform === 'darwin' ? app.focus({ steal: true }) : app.focus() + mainWindow.setAlwaysOnTop(false) const url = getLinkUrl(commandLine) if (url) { @@ -797,8 +803,13 @@ function runApp() { return } + process.platform === 'darwin' ? app.focus({ steal: true }) : app.focus() + newWindow.setAlwaysOnTop(true) newWindow.show() - newWindow.focus() + setTimeout(function() { newWindow.focus() }, 100) + newWindow.moveTop() + process.platform === 'darwin' ? app.focus({ steal: true }) : app.focus() + newWindow.setAlwaysOnTop(false) if (process.env.NODE_ENV === 'development') { newWindow.webContents.openDevTools({ activate: false })