Skip to content

Commit fbbee5c

Browse files
committed
MOBILE-2180 desktop: Focus when relaunched and use exit instead of quit
1 parent 7a79bda commit fbbee5c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

www/electron.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ app.on('ready', function() {
5959

6060
// Quit when all windows are closed.
6161
app.on('window-all-closed', () => {
62-
app.quit();
62+
app.exit();
6363
});
6464

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

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

102+
// Listen for open-url events (Mac OS only).
103+
app.on('open-url', (event, url) => {
104+
event.preventDefault();
105+
appLaunched(url);
106+
});
107+
104108
function appLaunched(url) {
105109
// App was launched again with a URL. Focus the main window and send an event to treat the URL.
106110
if (mainWindow) {

0 commit comments

Comments
 (0)