Use Single Instance App mode on Linux

This Electron feature now works on Linux again as of Electron 1.7.8.

Fixes #164 (multiple windows opening on Linux when clicking lbry://
links)
This commit is contained in:
Alex Liebowitz 2017-10-12 18:04:31 -04:00
parent 992c9d16a3
commit c9bd5ad488

View file

@ -227,24 +227,20 @@ function quitNow() {
app.quit();
}
if (process.platform != 'linux') {
// On Linux, this is always returning true due to an Electron bug,
// so for now we just don't support single-instance apps on Linux.
const isSecondaryInstance = app.makeSingleInstance((argv) => {
if (argv.length >= 2) {
handleOpenUriRequested(argv[1]); // This will handle restoring and focusing the window
} else if (win) {
if (win.isMinimized()) {
win.restore();
}
win.focus();
const isSecondaryInstance = app.makeSingleInstance((argv) => {
if (argv.length >= 2) {
handleOpenUriRequested(argv[1]); // This will handle restoring and focusing the window
} else if (win) {
if (win.isMinimized()) {
win.restore();
}
});
if (isSecondaryInstance) { // We're not in the original process, so quit
quitNow();
return;
win.focus();
}
});
if (isSecondaryInstance) { // We're not in the original process, so quit
quitNow();
return;
}
app.on('ready', function(){