mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-30 17:01:25 +00:00
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();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform != 'linux') {
|
const isSecondaryInstance = app.makeSingleInstance((argv) => {
|
||||||
// On Linux, this is always returning true due to an Electron bug,
|
if (argv.length >= 2) {
|
||||||
// so for now we just don't support single-instance apps on Linux.
|
handleOpenUriRequested(argv[1]); // This will handle restoring and focusing the window
|
||||||
const isSecondaryInstance = app.makeSingleInstance((argv) => {
|
} else if (win) {
|
||||||
if (argv.length >= 2) {
|
if (win.isMinimized()) {
|
||||||
handleOpenUriRequested(argv[1]); // This will handle restoring and focusing the window
|
win.restore();
|
||||||
} else if (win) {
|
|
||||||
if (win.isMinimized()) {
|
|
||||||
win.restore();
|
|
||||||
}
|
|
||||||
win.focus();
|
|
||||||
}
|
}
|
||||||
});
|
win.focus();
|
||||||
|
|
||||||
if (isSecondaryInstance) { // We're not in the original process, so quit
|
|
||||||
quitNow();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isSecondaryInstance) { // We're not in the original process, so quit
|
||||||
|
quitNow();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('ready', function(){
|
app.on('ready', function(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue