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 => {
|
mainWindow.on('close', event => {
|
||||||
if (mainWindow.isFullScreen()) {
|
if (mainWindow.isFullScreen()) {
|
||||||
mainWindow.setFullScreen(false);
|
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;
|
return mainWindow;
|
||||||
@ -185,8 +185,8 @@ ipcMain.on('cancelNewWindowOverride', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function maybeHideWindow(window, event) {
|
function maybeHideWindow(window, event, fastQuit) {
|
||||||
if (isOSX()) {
|
if (isOSX() && !fastQuit) {
|
||||||
// this is called when exiting from clicking the cross button on the window
|
// this is called when exiting from clicking the cross button on the window
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
window.hide();
|
window.hide();
|
||||||
|
@ -34,7 +34,7 @@ if (isOSX()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
if (!isOSX()) {
|
if (!isOSX() || appArgs.fastQuit) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
10
docs/api.md
10
docs/api.md
@ -18,6 +18,7 @@
|
|||||||
- [[width]](#width)
|
- [[width]](#width)
|
||||||
- [[height]](#height)
|
- [[height]](#height)
|
||||||
- [[show-menu-bar]](#show-menu-bar)
|
- [[show-menu-bar]](#show-menu-bar)
|
||||||
|
- [[fast-quit]](#fast-quit)
|
||||||
- [[user-agent]](#user-agent)
|
- [[user-agent]](#user-agent)
|
||||||
- [[honest]](#honest)
|
- [[honest]](#honest)
|
||||||
- [[ignore-certificate]](#ignore-certificate)
|
- [[ignore-certificate]](#ignore-certificate)
|
||||||
@ -166,6 +167,14 @@ Height of the packaged application, defaults to `800px`.
|
|||||||
|
|
||||||
Specifies if the menu bar should be shown.
|
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]
|
#### [user-agent]
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -301,6 +310,7 @@ var options = {
|
|||||||
width: 1280,
|
width: 1280,
|
||||||
height: 800,
|
height: 800,
|
||||||
showMenuBar: false,
|
showMenuBar: false,
|
||||||
|
fastQuit: false,
|
||||||
userAgent: 'Mozilla ...', // will infer a default for your current system
|
userAgent: 'Mozilla ...', // will infer a default for your current system
|
||||||
ignoreCertificate: false,
|
ignoreCertificate: false,
|
||||||
insecure: false,
|
insecure: false,
|
||||||
|
@ -100,6 +100,7 @@ function selectAppArgs(options) {
|
|||||||
width: options.width,
|
width: options.width,
|
||||||
height: options.height,
|
height: options.height,
|
||||||
showMenuBar: options.showMenuBar,
|
showMenuBar: options.showMenuBar,
|
||||||
|
fastQuit: options.fastQuit,
|
||||||
userAgent: options.userAgent,
|
userAgent: options.userAgent,
|
||||||
nativefierVersion: options.nativefierVersion,
|
nativefierVersion: options.nativefierVersion,
|
||||||
ignoreCertificate: options.ignoreCertificate,
|
ignoreCertificate: options.ignoreCertificate,
|
||||||
|
@ -32,6 +32,7 @@ if (require.main === module) {
|
|||||||
.option('--width <value>', 'set window width, defaults to 1280px', parseInt)
|
.option('--width <value>', 'set window width, defaults to 1280px', parseInt)
|
||||||
.option('--height <value>', 'set window height, defaults to 800px', parseInt)
|
.option('--height <value>', 'set window height, defaults to 800px', parseInt)
|
||||||
.option('-m, --show-menu-bar', 'set menu bar visible, defaults to false')
|
.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('-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('--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')
|
.option('--ignore-certificate', 'ignore certificate related errors')
|
||||||
|
@ -47,6 +47,7 @@ function optionsFactory(inpOptions, callback) {
|
|||||||
width: inpOptions.width || 1280,
|
width: inpOptions.width || 1280,
|
||||||
height: inpOptions.height || 800,
|
height: inpOptions.height || 800,
|
||||||
showMenuBar: inpOptions.showMenuBar || false,
|
showMenuBar: inpOptions.showMenuBar || false,
|
||||||
|
fastQuit: inpOptions.fastQuit || false,
|
||||||
userAgent: inpOptions.userAgent,
|
userAgent: inpOptions.userAgent,
|
||||||
ignoreCertificate: inpOptions.ignoreCertificate || false,
|
ignoreCertificate: inpOptions.ignoreCertificate || false,
|
||||||
insecure: inpOptions.insecure || false,
|
insecure: inpOptions.insecure || false,
|
||||||
|
Loading…
Reference in New Issue
Block a user