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:
parent
992c9d16a3
commit
c9bd5ad488
1 changed files with 12 additions and 16 deletions
28
app/main.js
28
app/main.js
|
@ -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(){
|
||||
|
|
Loading…
Add table
Reference in a new issue