uber basic multi-profile support for electron app

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-05-26 09:45:30 +01:00
parent 5ccab395d7
commit 0fb6a305a3
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@
"description": "A feature-rich client for Matrix.org",
"author": "Vector Creations Ltd.",
"dependencies": {
"electron-window-state": "^4.1.0"
"electron-window-state": "^4.1.0",
"minimist": "^1.2.0"
}
}

View File

@ -23,6 +23,7 @@ limitations under the License.
const check_squirrel_hooks = require('./squirrelhooks');
if (check_squirrel_hooks()) return;
const argv = require('minimist')(process.argv);
const electron = require('electron');
const tray = require('./tray');
@ -32,6 +33,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');
@ -191,7 +196,7 @@ electron.app.on('ready', () => {
brand: vectorConfig.brand || 'Riot'
});
if (!process.argv.includes('--hidden')) {
if (!argv.hidden) {
mainWindow.once('ready-to-show', () => {
mainWindow.show();
});