Tweak window size

Helps when running in Xvnc
This commit is contained in:
Andrew Ferrazzutti 2021-06-18 00:09:20 -04:00
parent 157f18d27f
commit 2fec597cba

View File

@ -27,7 +27,7 @@ export default class MessagesPuppeteer {
static executablePath = undefined static executablePath = undefined
static devtools = false static devtools = false
static noSandbox = false static noSandbox = false
static viewport = { width: 960, height: 880 } static viewport = { width: 960, height: 840 }
static url = undefined static url = undefined
static extensionDir = "extension_files" static extensionDir = "extension_files"
@ -68,18 +68,19 @@ export default class MessagesPuppeteer {
async start() { async start() {
this.log("Launching browser") this.log("Launching browser")
let extensionArgs = [ const args = [
`--disable-extensions-except=${MessagesPuppeteer.extensionDir}`, `--disable-extensions-except=${MessagesPuppeteer.extensionDir}`,
`--load-extension=${MessagesPuppeteer.extensionDir}` `--load-extension=${MessagesPuppeteer.extensionDir}`,
`--window-size=${MessagesPuppeteer.viewport.width},${MessagesPuppeteer.viewport.height+120}`,
] ]
if (MessagesPuppeteer.noSandbox) { if (MessagesPuppeteer.noSandbox) {
extensionArgs = extensionArgs.concat(`--no-sandbox`) args = args.concat(`--no-sandbox`)
} }
this.browser = await puppeteer.launch({ this.browser = await puppeteer.launch({
executablePath: MessagesPuppeteer.executablePath, executablePath: MessagesPuppeteer.executablePath,
userDataDir: this.profilePath, userDataDir: this.profilePath,
args: extensionArgs, args: args,
headless: false, // Needed to load extensions headless: false, // Needed to load extensions
defaultViewport: MessagesPuppeteer.viewport, defaultViewport: MessagesPuppeteer.viewport,
devtools: MessagesPuppeteer.devtools, devtools: MessagesPuppeteer.devtools,