From 49ab72352e9060f76414beddeb827a6c073ec70d Mon Sep 17 00:00:00 2001 From: matthewdias Date: Mon, 25 Apr 2016 17:09:01 -0500 Subject: [PATCH] merge upstream, reverse default --- app/src/components/mainWindow/mainWindow.js | 8 ++++---- app/src/main.js | 2 +- docs/api.md | 10 ++++++++++ src/build/buildApp.js | 1 + src/cli.js | 1 + src/options/optionsMain.js | 1 + 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/src/components/mainWindow/mainWindow.js b/app/src/components/mainWindow/mainWindow.js index 132f582..6b5d793 100644 --- a/app/src/components/mainWindow/mainWindow.js +++ b/app/src/components/mainWindow/mainWindow.js @@ -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(); diff --git a/app/src/main.js b/app/src/main.js index 433227e..69540d4 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -34,7 +34,7 @@ if (isOSX()) { } app.on('window-all-closed', () => { - if (!isOSX()) { + if (!isOSX() || appArgs.fastQuit) { app.quit(); } }); diff --git a/docs/api.md b/docs/api.md index 62b61c0..6f9a154 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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, diff --git a/src/build/buildApp.js b/src/build/buildApp.js index 09791ef..857afac 100644 --- a/src/build/buildApp.js +++ b/src/build/buildApp.js @@ -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, diff --git a/src/cli.js b/src/cli.js index 75a1d0a..60efac3 100755 --- a/src/cli.js +++ b/src/cli.js @@ -32,6 +32,7 @@ if (require.main === module) { .option('--width ', 'set window width, defaults to 1280px', parseInt) .option('--height ', '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 ', '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') diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index d3ec0e7..b31e1fd 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -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,