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

@ -2,6 +2,8 @@
## next
- main
- add `--fullscreen` switch (default gui only, bypasses the sidepanel fullscreen button)
- widgets
- knob: big knobs design tweaks

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('&') : '',

View file

@ -28,6 +28,7 @@ Below are the available command-line options. Note that when running without any
| |`--disable-gpu` | disable hardware acceleration |
| |`--read-only` | disable session editing and session history changes |
| |`--instance-name` | used to differenciate multiple instances in a zeroconf network |
| |`--fullscreen` | launch the default client gui in fullscreen mode (F11 to exit) |
Command-line only :

View file

@ -3,6 +3,8 @@ location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (s,k,v)=>{
ARGV[k]=v
})
window.ELECTRON_FULLSCREEN = window.ELECTRON_FULLSCREEN || false
window.PACKAGE = require('../../../../app/package.json')
document.title = PACKAGE.productName + ' v' + PACKAGE.version

View file

@ -9,11 +9,11 @@ var sidepanelData = [
{
actions: [
{
title:'Fullscreen',
title:'Fullscreen' + (ELECTRON_FULLSCREEN ? ' (F11)' : ''),
action:()=>{
if (fullscreen.enabled) fullscreen.toggle()
},
class:'fullscreenToggle'
class:'fullscreenToggle' + (!fullscreen.enabled || ELECTRON_FULLSCREEN ? ' disabled' : '')
}
]
@ -152,11 +152,8 @@ if (fullscreen.enabled) {
fullscreen.on('change', ()=>{
fsToggle.classList.toggle('on', fullscreen.isFullScreen)
})
} else {
fsToggle.classList.add('disabled')
}
// open / close / toggle
var sidepaneLock = false