diff --git a/electron_app/package.json b/electron_app/package.json index 8da35d84..0b6113e7 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -6,7 +6,8 @@ "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "dependencies": { + "electron-window-state": "^4.1.0", "auto-launch": "^5.0.1", - "electron-window-state": "^4.1.0" + "minimist": "^1.2.0" } } diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index a5708164..ef0d173c 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -21,6 +21,7 @@ limitations under the License. const checkSquirrelHooks = require('./squirrelhooks'); if (checkSquirrelHooks()) return; +const argv = require('minimist')(process.argv); const electron = require('electron'); const AutoLaunch = require('auto-launch'); @@ -30,6 +31,10 @@ const webContentsHandler = require('./webcontents-handler'); const windowStateKeeper = require('electron-window-state'); +if (argv.profile) { + electron.app.setPath('userData', `${electron.app.getPath('userData')}-${argv.profile}`); +} + let vectorConfig = {}; try { vectorConfig = require('../../webapp/config.json'); @@ -166,7 +171,7 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector if (shouldQuit) { console.log('Other instance detected: exiting'); - electron.app.quit(); + electron.app.exit(); } @@ -249,7 +254,7 @@ electron.app.on('ready', () => { brand: vectorConfig.brand || 'Riot', }); - if (!process.argv.includes('--hidden')) { + if (!argv.hidden) { mainWindow.once('ready-to-show', () => { mainWindow.show(); });