2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-23 10:38:55 +00:00

Implement command line flag to start app in full screen, resolves #109

This commit is contained in:
Jia Hao 2016-02-25 18:26:28 +08:00
parent 1c334a3d7d
commit 31ee80f84f
5 changed files with 22 additions and 3 deletions

View File

@ -267,6 +267,14 @@ Example:
$ nativefier http://google.com --inject ./some-js-injection.js --inject ./some-css-injection.css ~/Desktop $ nativefier http://google.com --inject ./some-js-injection.js --inject ./some-css-injection.css ~/Desktop
``` ```
#### [inject]
```
--full-screen
```
Makes the packaged app start in full screen.
## Programmatic API ## Programmatic API
You can use the Nativefier programmatic API as well. You can use the Nativefier programmatic API as well.

View File

@ -41,9 +41,17 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
preload: path.join(__dirname, 'static', 'preload.js') preload: path.join(__dirname, 'static', 'preload.js')
}, },
// after webpack path here should reference `resources/app/` // after webpack path here should reference `resources/app/`
icon: path.join(__dirname, '../', '/icon.png') icon: path.join(__dirname, '../', '/icon.png'),
// set to undefined and not false because explicitly setting to false will disable full screen
fullscreen: options.fullScreen || undefined
}); });
// after first run, no longer force full screen to be true
if (options.fullScreen) {
options.fullScreen = undefined;
fs.writeFileSync(path.join(__dirname, '..', 'nativefier.json'), JSON.stringify(options));
}
let currentZoom = 1; let currentZoom = 1;
const onZoomIn = () => { const onZoomIn = () => {

View File

@ -104,7 +104,8 @@ function selectAppArgs(options) {
nativefierVersion: options.nativefierVersion, nativefierVersion: options.nativefierVersion,
ignoreCertificate: options.ignoreCertificate, ignoreCertificate: options.ignoreCertificate,
insecure: options.insecure, insecure: options.insecure,
flashPluginDir: options.flashPluginDir flashPluginDir: options.flashPluginDir,
fullScreen: options.fullScreen
}; };
} }

View File

@ -38,6 +38,7 @@ if (require.main === module) {
.option('--insecure', 'enable loading of insecure content, defaults to false') .option('--insecure', 'enable loading of insecure content, defaults to false')
.option('--flash <value>', 'path to Chrome flash plugin, find it in `Chrome://plugins`') .option('--flash <value>', 'path to Chrome flash plugin, find it in `Chrome://plugins`')
.option('--inject <value>', 'path to a file to be injected', collect, []) .option('--inject <value>', 'path to a file to be injected', collect, [])
.option('--full-screen', 'if the app should always be started in full screen')
.parse(process.argv); .parse(process.argv);
if (!process.argv.slice(2).length) { if (!process.argv.slice(2).length) {

View File

@ -49,7 +49,8 @@ function optionsFactory(inpOptions, callback) {
ignoreCertificate: inpOptions.ignoreCertificate || false, ignoreCertificate: inpOptions.ignoreCertificate || false,
insecure: inpOptions.insecure || false, insecure: inpOptions.insecure || false,
flashPluginDir: inpOptions.flash || null, flashPluginDir: inpOptions.flash || null,
inject: inpOptions.inject || null inject: inpOptions.inject || null,
fullScreen: inpOptions.fullScreen || false
}; };
if (inpOptions.honest) { if (inpOptions.honest) {