mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-09 00:21:10 +00:00
parent
fcab2a9a95
commit
7945f7802e
@ -28,6 +28,10 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
frame: !options.hideWindowFrame,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
minWidth: options.minWidth,
|
||||
minHeight: options.minHeight,
|
||||
maxWidth: options.maxWidth,
|
||||
maxHeight: options.maxHeight,
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
autoHideMenuBar: !options.showMenuBar,
|
||||
|
36
docs/api.md
36
docs/api.md
@ -17,6 +17,10 @@
|
||||
- [[counter]](#counter)
|
||||
- [[width]](#width)
|
||||
- [[height]](#height)
|
||||
- [[min-width]](#min-width)
|
||||
- [[min-height]](#min-height)
|
||||
- [[max-width]](#max-width)
|
||||
- [[max-height]](#max-height)
|
||||
- [[show-menu-bar]](#show-menu-bar)
|
||||
- [[fast-quit]](#fast-quit)
|
||||
- [[user-agent]](#user-agent)
|
||||
@ -159,6 +163,38 @@ Width of the packaged application, defaults to `1280px`.
|
||||
|
||||
Height of the packaged application, defaults to `800px`.
|
||||
|
||||
#### [min-width]
|
||||
|
||||
```
|
||||
--min-width <value>
|
||||
```
|
||||
|
||||
Minimum width of the packaged application, defaults to `0`.
|
||||
|
||||
#### [min-height]
|
||||
|
||||
```
|
||||
--min-height <value>
|
||||
```
|
||||
|
||||
Minimum height of the packaged application, defaults to `0`.
|
||||
|
||||
#### [max-width]
|
||||
|
||||
```
|
||||
--max-width <value>
|
||||
```
|
||||
|
||||
Maximum width of the packaged application, default is no limit.
|
||||
|
||||
#### [max-height]
|
||||
|
||||
```
|
||||
--max-height <value>
|
||||
```
|
||||
|
||||
Maximum height of the packaged application, default is no limit.
|
||||
|
||||
#### [show-menu-bar]
|
||||
|
||||
```
|
||||
|
@ -99,6 +99,10 @@ function selectAppArgs(options) {
|
||||
counter: options.counter,
|
||||
width: options.width,
|
||||
height: options.height,
|
||||
minWidth: options.minWidth,
|
||||
minHeight: options.minHeight,
|
||||
maxWidth: options.maxWidth,
|
||||
maxHeight: options.maxHeight,
|
||||
showMenuBar: options.showMenuBar,
|
||||
fastQuit: options.fastQuit,
|
||||
userAgent: options.userAgent,
|
||||
|
@ -29,8 +29,12 @@ if (require.main === module) {
|
||||
.option('-c, --conceal', 'packages the source code within your app into an archive, defaults to false, see http://electron.atom.io/docs/v0.36.0/tutorial/application-packaging/')
|
||||
.option('--counter', 'if the target app should use a persistant counter badge in the dock (OSX only), defaults to false')
|
||||
.option('-i, --icon <value>', 'the icon file to use as the icon for the app (should be a .icns file on OSX, .png for Windows and Linux)')
|
||||
.option('--width <value>', 'set window width, defaults to 1280px', parseInt)
|
||||
.option('--height <value>', 'set window height, defaults to 800px', parseInt)
|
||||
.option('--width <value>', 'set window default width, defaults to 1280px', parseInt)
|
||||
.option('--height <value>', 'set window default height, defaults to 800px', parseInt)
|
||||
.option('--min-width <value>', 'set window minimum width, defaults to 0px', parseInt)
|
||||
.option('--min-height <value>', 'set window minimum height, defaults to 0px', parseInt)
|
||||
.option('--max-width <value>', 'set window maximum width, default is no limit', parseInt)
|
||||
.option('--max-height <value>', 'set window maximum height, default is no limit', parseInt)
|
||||
.option('-m, --show-menu-bar', 'set menu bar visible, defaults to false')
|
||||
.option('-f, --fast-quit', 'quit app after window close (OSX only), defaults to false')
|
||||
.option('-u, --user-agent <value>', 'set the user agent string for the app')
|
||||
|
@ -46,6 +46,10 @@ function optionsFactory(inpOptions, callback) {
|
||||
counter: inpOptions.counter || false,
|
||||
width: inpOptions.width || 1280,
|
||||
height: inpOptions.height || 800,
|
||||
minWidth: inpOptions.minWidth,
|
||||
minHeight: inpOptions.minHeight,
|
||||
maxWidth: inpOptions.maxWidth,
|
||||
maxHeight: inpOptions.maxHeight,
|
||||
showMenuBar: inpOptions.showMenuBar || false,
|
||||
fastQuit: inpOptions.fastQuit || false,
|
||||
userAgent: inpOptions.userAgent,
|
||||
@ -84,6 +88,14 @@ function optionsFactory(inpOptions, callback) {
|
||||
options.platform = 'darwin';
|
||||
}
|
||||
|
||||
if (options.width > options.maxWidth) {
|
||||
options.width = options.maxWidth;
|
||||
}
|
||||
|
||||
if (options.height > options.maxHeight) {
|
||||
options.height = options.maxHeight;
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
callback => {
|
||||
if (options.userAgent) {
|
||||
|
Loading…
Reference in New Issue
Block a user