diff --git a/app/src/components/mainWindow/mainWindow.js b/app/src/components/mainWindow/mainWindow.js index f5e0c60..2e2b77b 100644 --- a/app/src/components/mainWindow/mainWindow.js +++ b/app/src/components/mainWindow/mainWindow.js @@ -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, diff --git a/docs/api.md b/docs/api.md index 6f9a154..c508743 100644 --- a/docs/api.md +++ b/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 +``` + +Minimum width of the packaged application, defaults to `0`. + +#### [min-height] + +``` +--min-height +``` + +Minimum height of the packaged application, defaults to `0`. + +#### [max-width] + +``` +--max-width +``` + +Maximum width of the packaged application, default is no limit. + +#### [max-height] + +``` +--max-height +``` + +Maximum height of the packaged application, default is no limit. + #### [show-menu-bar] ``` diff --git a/src/build/buildApp.js b/src/build/buildApp.js index d9a9c2e..824d651 100644 --- a/src/build/buildApp.js +++ b/src/build/buildApp.js @@ -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, diff --git a/src/cli.js b/src/cli.js index 60efac3..2b58d98 100755 --- a/src/cli.js +++ b/src/cli.js @@ -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 ', '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 ', 'set window width, defaults to 1280px', parseInt) - .option('--height ', 'set window height, defaults to 800px', parseInt) + .option('--width ', 'set window default width, defaults to 1280px', parseInt) + .option('--height ', 'set window default height, defaults to 800px', parseInt) + .option('--min-width ', 'set window minimum width, defaults to 0px', parseInt) + .option('--min-height ', 'set window minimum height, defaults to 0px', parseInt) + .option('--max-width ', 'set window maximum width, default is no limit', parseInt) + .option('--max-height ', '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 ', 'set the user agent string for the app') diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index dda44e8..4e18a32 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -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) {