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
})

View file

@ -35,12 +35,16 @@ var start = function(readyApp) {
var app = require('./electron-app')
var address = typeof settings.read('guiOnly')=='string'? 'http://' + settings.read('guiOnly') : settings.read('appAddresses')[0]
address += settings.read('urlOptions')
if (app.isReady()) {
var win = require('./electron-window')({address:address, shortcuts:true})
var launch = ()=>{
var win = require('./electron-window')({address:address, shortcuts:true, fullscreen: settings.read('fullScreen')})
return win
}
if (app.isReady()) {
return launch()
} else {
app.on('ready',function(){
var win = require('./electron-window')({address:address, shortcuts:true})
launch()
})
}
}
@ -62,7 +66,7 @@ if (settings.cli) {
launcher
app.on('ready',function(){
launcher = require('./electron-window')({address:address, shortcuts:false, width:680, height:626, node:true, color:'#283143'})
launcher = require('./electron-window')({address:address, shortcuts:false, width:680, height:655, node:true, color:'#283143'})
})
if (process.log) {

View file

@ -71,8 +71,8 @@ var options = {
true : 'blank session can\'t be started in read-only mode'
}
},
'instance-name':{type:'string',describe:'used to differenciate multiple instances in a zeroconf network'
},
'instance-name':{type:'string',describe:'used to differenciate multiple instances in a zeroconf network'},
'fullscreen':{type:'boolean', describe:'launch the default client gui in fullscreen mode (F11 to exit)'}
}
@ -167,6 +167,7 @@ var makeDefaultConfig = function(argv){
sessionFile: argv.l || false,
newSession: argv.b || false,
customModule: argv.c || false,
fullScreen: argv['fullscreen'] || false,
noGui: argv.n || false,
guiOnly: typeof argv.g == 'string' ? argv.g.length ? argv.g : true : false,
urlOptions: argv['url-options'] ? '?' + argv['url-options'].join('&') : '',