Skip to content

Commit 21cf79b

Browse files
authored
Merge pull request element-hq#4030 from vector-im/t3chguy/electron_profiles
basic electron profile support
2 parents 292b50f + 5762323 commit 21cf79b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎electron_app/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"description": "A feature-rich client for Matrix.org",
77
"author": "Vector Creations Ltd.",
88
"dependencies": {
9+
"electron-window-state": "^4.1.0",
910
"auto-launch": "^5.0.1",
10-
"electron-window-state": "^4.1.0"
11+
"minimist": "^1.2.0"
1112
}
1213
}

‎electron_app/src/electron-main.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ limitations under the License.
2121
const checkSquirrelHooks = require('./squirrelhooks');
2222
if (checkSquirrelHooks()) return;
2323

24+
const argv = require('minimist')(process.argv);
2425
const electron = require('electron');
2526
const AutoLaunch = require('auto-launch');
2627

@@ -30,6 +31,10 @@ const webContentsHandler = require('./webcontents-handler');
3031

3132
const windowStateKeeper = require('electron-window-state');
3233

34+
if (argv.profile) {
35+
electron.app.setPath('userData', `${electron.app.getPath('userData')}-${argv.profile}`);
36+
}
37+
3338
let vectorConfig = {};
3439
try {
3540
vectorConfig = require('../../webapp/config.json');
@@ -166,7 +171,7 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector
166171

167172
if (shouldQuit) {
168173
console.log('Other instance detected: exiting');
169-
electron.app.quit();
174+
electron.app.exit();
170175
}
171176

172177

@@ -249,7 +254,7 @@ electron.app.on('ready', () => {
249254
brand: vectorConfig.brand || 'Riot',
250255
});
251256

252-
if (!process.argv.includes('--hidden')) {
257+
if (!argv.hidden) {
253258
mainWindow.once('ready-to-show', () => {
254259
mainWindow.show();
255260
});

0 commit comments

Comments
 (0)