-
Notifications
You must be signed in to change notification settings - Fork 156
Two instances are opened when I try to open a single file #258
Comments
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. 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 |
@brrd I suppose you won't need a PR for this, but ping me if needed. |
fixes issue brrd#258
Sorry if I'm polluting your Issues board here with my fork commit. I just wanted to fix it for myself. |
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
The text was updated successfully, but these errors were encountered: