Merge pull request #170 from BugiDev/feature/maximization

Added option for maximization of main window ( #133 )
This commit is contained in:
Jia Hao 2016-03-23 03:41:24 +08:00
commit f4f315bb5f
5 changed files with 22 additions and 2 deletions

View File

@ -52,6 +52,13 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
fs.writeFileSync(path.join(__dirname, '..', 'nativefier.json'), JSON.stringify(options));
}
// after first run, no longer force maximize to be true
if (options.maximize) {
mainWindow.maximize();
options.maximize = undefined;
fs.writeFileSync(path.join(__dirname, '..', 'nativefier.json'), JSON.stringify(options));
}
let currentZoom = 1;
const onZoomIn = () => {

View File

@ -25,6 +25,7 @@
- [[flash]](#flash)
- [[inject]](#inject)
- [[full-screen]](#full-screen)
- [[maximize]](#maximize)
- [Programmatic API](#programmatic-api)
## Command Line
@ -226,6 +227,15 @@ $ nativefier http://google.com --inject ./some-js-injection.js --inject ./some-c
Makes the packaged app start in full screen.
#### [maximize]
```
--maximize
```
Makes the packaged app start maximized.
## Programmatic API
You can use the Nativefier programmatic API as well.

View File

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

View File

@ -39,6 +39,7 @@ if (require.main === module) {
.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('--full-screen', 'if the app should always be started in full screen')
.option('--maximize', 'if the app should always be started maximized')
.parse(process.argv);
if (!process.argv.slice(2).length) {

View File

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