mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 10:38:55 +00:00
Merge pull request #178 from matthewdias/development
make keeping os x apps running optional
This commit is contained in:
commit
319589de7b
@ -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();
|
||||
|
@ -34,7 +34,7 @@ if (isOSX()) {
|
||||
}
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (!isOSX()) {
|
||||
if (!isOSX() || appArgs.fastQuit) {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
10
docs/api.md
10
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,
|
||||
|
@ -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,
|
||||
|
@ -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')
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user