Line 47 checks if the first CLI argument commandLine[0] ends with "electron" in the name. This is true if you use npm run electron so likely it'll work in testing & debugging. However, on a windows system the first argument is "C:...\Gingko.exe". The means the code to open another document is never opened
A hacky solution might be as follows, however it doesn't account for Mac or Linux users.
app.on("second-instance", (event, commandLine) => {
if (
commandLine[0].endsWith("electron") &&
typeof commandLine[2] == "string"
) {
openDocument(commandLine[2]);
// new part
} else if (
commandLine[0].toLowerCase().endsWith("gingko.exe") &&
typeof commandLine[1] == "string"
) {
openDocument(commandLine[1]);
// end new part
} else if (winHome) {
winHome.show();
} else {
createHomeWindow();
}
});
Describe the bug When Gingko is already open, and I open a
*.gko
file, it opens a new window with the home screen instead of the intended file.To Reproduce Steps to reproduce the behavior:
Expected behavior I would expect a second window to appear with the second file.
Screenshots Home Screen shown on second file open
Software info:
Additional context I've not had a chance to test this solution myself, but it might be to do with how
app.on("second-instance", ...)
is handled.https://github.com/gingko/client/blob/ba6e49edc0948c14e453b20036b75bf88dc42af1/src/electron/main.js#L39-L57
Line 47 checks if the first CLI argument
commandLine[0]
ends with "electron" in the name. This is true if you usenpm run electron
so likely it'll work in testing & debugging. However, on a windows system the first argument is "C:...\Gingko.exe". The means the code to open another document is never openedA hacky solution might be as follows, however it doesn't account for Mac or Linux users.