From 2ed7d479387a3a0c77074dfebd905228cfcf75d9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 23 Dec 2015 15:57:38 -0700 Subject: [PATCH] re-show window of app if re-run --- console/src/main.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/console/src/main.js b/console/src/main.js index d2e6d53af2..f009086984 100644 --- a/console/src/main.js +++ b/console/src/main.js @@ -73,6 +73,22 @@ app.on('activate', function(){ } }) +var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { + // Someone tried to run a second instance, we should focus our window + if (mainWindow) { + if (mainWindow.isMinimized()) { + mainWindow.restore(); + } + mainWindow.focus(); + } + return true; +}); + +if (shouldQuit) { + app.quit(); + return; +} + // Check command line arguments to see how to find binaries var argv = require('yargs').argv; var pathFinder = require('./modules/path-finder.js');