Closed rudolfvesely closed 4 years ago
This might be related?
Probably yes. Obviously the document is redirected to the first instance as expected, but it is still opened in the new instance, which makes a duplicate.
@brrd It seems that the second instance continue its startup process even though it failed to acquire the lock. From the docs, you should add this:
const { app } = require('electron')
let myWindow = null
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (myWindow) {
if (myWindow.isMinimized()) myWindow.restore()
myWindow.focus()
}
})
// Create myWindow, load the rest of the app, etc...
app.on('ready', () => {
})
}
Or you could simply do this at line 18:
app.requestSingleInstanceLock() || app.quit();
@GitSquared Yes, you're right. It should use app.requestSingleInstanceLock()
return value. I obviously forgot this point when I moved from the previous API.
@brrd I suppose you won't need a PR for this, but ping me if needed.
Sorry if I'm polluting your Issues board here with my fork commit. I just wanted to fix it for myself. One thing: I couldn't build Abricotine with the latest Node.js 13.8.0 due to the spellchecker module, but it works fine with node version 12.14.1
Hi all,
Fantastic Markdown editor. Thank you for the great work.
The only issue I have is that when I click on another (second, third...) markdown file the editor is opened twice. I recorded a short GIF to explain:
My environment:
Abricotine: 7.0.0 Linux with KDE Plasma 5.14 desktop
Kind regards, Rudolf