main: add --fullscreen option (issue #164)

This commit is contained in:
jean-emmanuel 2018-02-28 11:22:31 +01:00
parent 1dc144cb44
commit d7375ab060
7 changed files with 30 additions and 12 deletions

View file

@ -17,7 +17,8 @@ module.exports = function(options={}) {
title: options.title || settings.read('appName'),
icon: path.resolve(__dirname + '/../browser/logo.png'),
backgroundColor: options.color || bgColor,
type:options.type,
type: options.type,
fullscreen: options.fullscreen,
webPreferences: {
nodeIntegration: !!options.node
}
@ -37,6 +38,16 @@ module.exports = function(options={}) {
}
})
if (options.fullscreen) {
window.webContents.on('dom-ready', ()=>{
window.webContents.executeJavaScript(`
window.ELECTRON_FULLSCREEN = true
`)
})
}
window.on('closed', function() {
window = null
})