Merge pull request #4030 from vector-im/t3chguy/electron_profiles
basic electron profile supportrelease-v0.10.0-rc.1
commit
21cf79bc54
|
@ -6,7 +6,8 @@
|
||||||
"description": "A feature-rich client for Matrix.org",
|
"description": "A feature-rich client for Matrix.org",
|
||||||
"author": "Vector Creations Ltd.",
|
"author": "Vector Creations Ltd.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"electron-window-state": "^4.1.0",
|
||||||
"auto-launch": "^5.0.1",
|
"auto-launch": "^5.0.1",
|
||||||
"electron-window-state": "^4.1.0"
|
"minimist": "^1.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ limitations under the License.
|
||||||
const checkSquirrelHooks = require('./squirrelhooks');
|
const checkSquirrelHooks = require('./squirrelhooks');
|
||||||
if (checkSquirrelHooks()) return;
|
if (checkSquirrelHooks()) return;
|
||||||
|
|
||||||
|
const argv = require('minimist')(process.argv);
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const AutoLaunch = require('auto-launch');
|
const AutoLaunch = require('auto-launch');
|
||||||
|
|
||||||
|
@ -30,6 +31,10 @@ const webContentsHandler = require('./webcontents-handler');
|
||||||
|
|
||||||
const windowStateKeeper = require('electron-window-state');
|
const windowStateKeeper = require('electron-window-state');
|
||||||
|
|
||||||
|
if (argv.profile) {
|
||||||
|
electron.app.setPath('userData', `${electron.app.getPath('userData')}-${argv.profile}`);
|
||||||
|
}
|
||||||
|
|
||||||
let vectorConfig = {};
|
let vectorConfig = {};
|
||||||
try {
|
try {
|
||||||
vectorConfig = require('../../webapp/config.json');
|
vectorConfig = require('../../webapp/config.json');
|
||||||
|
@ -166,7 +171,7 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector
|
||||||
|
|
||||||
if (shouldQuit) {
|
if (shouldQuit) {
|
||||||
console.log('Other instance detected: exiting');
|
console.log('Other instance detected: exiting');
|
||||||
electron.app.quit();
|
electron.app.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,7 +254,7 @@ electron.app.on('ready', () => {
|
||||||
brand: vectorConfig.brand || 'Riot',
|
brand: vectorConfig.brand || 'Riot',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.argv.includes('--hidden')) {
|
if (!argv.hidden) {
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue