Merge pull request #2999 from vector-im/dbkr/carlos22_single_instance

Make riot desktop single instance
This commit is contained in:
Richard van der Hoff 2017-01-19 18:04:09 +00:00 committed by GitHub
commit 693285ac0e

View file

@ -161,6 +161,19 @@ electron.ipcMain.on('install_update', installUpdate);
electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing'); electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing');
const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (!mainWindow.isVisible()) mainWindow.show();
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});
if (shouldQuit) {
electron.app.quit()
}
electron.app.on('ready', () => { electron.app.on('ready', () => {
if (vectorConfig.update_base_url) { if (vectorConfig.update_base_url) {
console.log("Starting auto update with base URL: " + vectorConfig.update_base_url); console.log("Starting auto update with base URL: " + vectorConfig.update_base_url);