Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions www/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ app.on('ready', function() {

// Quit when all windows are closed.
app.on('window-all-closed', () => {
app.quit();
app.exit();
});

app.on('activate', () => {
Expand Down Expand Up @@ -87,20 +87,24 @@ var shouldQuit = app.makeSingleInstance((argv, workingDirectory) => {
// Another instance was launched. If it was launched with a URL, it should be in the second param.
if (argv && argv[1]) {
appLaunched(argv[1]);
} else {
focusApp();
}
});

if (shouldQuit) {
// For some reason, shouldQuit is always true in signed Mac apps so we should ingore it.
if (shouldQuit && os.platform().indexOf('darwin') == -1) {
// It's not the main instance of the app, kill it.
app.quit();
} else {
// Listen for open-url events (Mac OS only).
app.on('open-url', (event, url) => {
event.preventDefault();
appLaunched(url);
});
app.exit();
return;
}

// Listen for open-url events (Mac OS only).
app.on('open-url', (event, url) => {
event.preventDefault();
appLaunched(url);
});

function appLaunched(url) {
// App was launched again with a URL. Focus the main window and send an event to treat the URL.
if (mainWindow) {
Expand Down