merge upstream, reverse default

This commit is contained in:
matthewdias 2016-04-25 17:09:01 -05:00
parent ece19efba2
commit 49ab72352e
6 changed files with 18 additions and 5 deletions

View File

@ -170,9 +170,9 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
mainWindow.on('close', event => {
if (mainWindow.isFullScreen()) {
mainWindow.setFullScreen(false);
mainWindow.once('leave-full-screen', maybeHideWindow.bind(this, mainWindow, event));
mainWindow.once('leave-full-screen', maybeHideWindow.bind(this, mainWindow, event, options.fastQuit));
}
maybeHideWindow(mainWindow, event);
maybeHideWindow(mainWindow, event, options.fastQuit);
});
return mainWindow;
@ -185,8 +185,8 @@ ipcMain.on('cancelNewWindowOverride', () => {
});
});
function maybeHideWindow(window, event) {
if (isOSX()) {
function maybeHideWindow(window, event, fastQuit) {
if (isOSX() && !fastQuit) {
// this is called when exiting from clicking the cross button on the window
event.preventDefault();
window.hide();

View File

@ -34,7 +34,7 @@ if (isOSX()) {
}
app.on('window-all-closed', () => {
if (!isOSX()) {
if (!isOSX() || appArgs.fastQuit) {
app.quit();
}
});

View File

@ -18,6 +18,7 @@
- [[width]](#width)
- [[height]](#height)
- [[show-menu-bar]](#show-menu-bar)
- [[fast-quit]](#fast-quit)
- [[user-agent]](#user-agent)
- [[honest]](#honest)
- [[ignore-certificate]](#ignore-certificate)
@ -166,6 +167,14 @@ Height of the packaged application, defaults to `800px`.
Specifies if the menu bar should be shown.
#### [fast-quit]
```
-f, --fast-quit
```
(OSX Only) Specifies to quit the app after closing all windows, defaults to false.
#### [user-agent]
```
@ -301,6 +310,7 @@ var options = {
width: 1280,
height: 800,
showMenuBar: false,
fastQuit: false,
userAgent: 'Mozilla ...', // will infer a default for your current system
ignoreCertificate: false,
insecure: false,

View File

@ -100,6 +100,7 @@ function selectAppArgs(options) {
width: options.width,
height: options.height,
showMenuBar: options.showMenuBar,
fastQuit: options.fastQuit,
userAgent: options.userAgent,
nativefierVersion: options.nativefierVersion,
ignoreCertificate: options.ignoreCertificate,

View File

@ -32,6 +32,7 @@ if (require.main === module) {
.option('--width <value>', 'set window width, defaults to 1280px', parseInt)
.option('--height <value>', 'set window height, defaults to 800px', 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')
.option('--honest', 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser')
.option('--ignore-certificate', 'ignore certificate related errors')

View File

@ -47,6 +47,7 @@ function optionsFactory(inpOptions, callback) {
width: inpOptions.width || 1280,
height: inpOptions.height || 800,
showMenuBar: inpOptions.showMenuBar || false,
fastQuit: inpOptions.fastQuit || false,
userAgent: inpOptions.userAgent,
ignoreCertificate: inpOptions.ignoreCertificate || false,
insecure: inpOptions.insecure || false,