Merge pull request #4030 from vector-im/t3chguy/electron_profiles

basic electron profile support
release-v0.10.0-rc.1
Matthew Hodgson 2017-06-01 01:33:01 +01:00 committed by GitHub
commit 21cf79bc54
2 changed files with 9 additions and 3 deletions

View File

@ -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"
}
}

View File

@ -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();
});