Skip to content

Commit

Permalink
Added option for maximization of main window ( nativefier#133 )
Browse files Browse the repository at this point in the history
  • Loading branch information
BugiDev committed Mar 22, 2016
1 parent 266a239 commit 7351c61
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/src/components/mainWindow/mainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
10 changes: 10 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [[flash]](#flash)
- [[inject]](#inject)
- [[full-screen]](#full-screen)
- [[maximize]](#maximize)
- [Programmatic API](#programmatic-api)

## Command Line
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/build/buildApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down
1 change: 1 addition & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/options/optionsMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7351c61

Please sign in to comment.