Merge pull request #1019 from mattias-symphony/SDA-2160

fix: SDA-2160 Parse and apply --windowSize command line argument
This commit is contained in:
mattias-symphony 2020-06-12 08:17:33 +02:00 committed by GitHub
commit e258f01db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,8 @@ import {
windowExists,
} from './window-utils';
const windowSize: string | null = getCommandLineArgs(process.argv, '--window-size', false);
enum ClientSwitchType {
CLIENT_1_5 = 'CLIENT_1_5',
CLIENT_2_0 = 'CLIENT_2_0',
@ -209,6 +211,20 @@ export class WindowHandler {
}
}
logger.info('window-handler: windowSize: ' + JSON.stringify(windowSize));
if (windowSize) {
const args = windowSize.split('=');
const sizes = args[1].split(',');
logger.info('window-handler: windowSize: args: ' + JSON.stringify(args));
logger.info('window-handler: windowSize: sizes: ' + JSON.stringify(sizes));
DEFAULT_WIDTH = Number(sizes[0]);
DEFAULT_HEIGHT = Number(sizes[1]);
if (this.config.mainWinPos ) {
this.config.mainWinPos.width = DEFAULT_WIDTH;
this.config.mainWinPos.height = DEFAULT_HEIGHT;
}
}
// set window opts with additional config
this.mainWindow = new BrowserWindow({
...this.windowOpts, ...getBounds(this.config.mainWinPos, DEFAULT_WIDTH, DEFAULT_HEIGHT),