I'm trying to allow a file to be dragged into my electron app in Windows. Several things work:
- I can drag the file onto the DESKTOP icon - the app opens fine and I get the file I need through argv - both when the app is closed (through the initial load) and when the app is open through the "second-instance" handler.
- I can drag a file into the app - all works fine.
However, I would like to be able to SHIFT drag a file onto the electron app icon on the Windows Taskbar when the app is running. When I do the SHIFT drag, the tooltip says 'Open with Electron', but when I then drop....nothing happens. I have tried console logging inside the "second-instance" handler, which is what I would expect to fire...but nothing.
app.on("second-instance", (event, argv) => {
log.info("HERE");
// Someone tried to run a second instance, we should focus our window.
if (argv.length >= 2) {
const urlPath = encodeURI(`file:///${argv[argv.length - 1]}`);
openDeepLink(`app://open-image-url?location=${urlPath}`, mainWindow);
}
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.focus();
}
});
(the deeplink shortcode isn't really 'app' of course). The log.info for "HERE" never fires (I have tested log.info works elsewhere just in case, it does!).
I am running: Windows 10 (fully updated) capacitor-community/electron: 1.3.1 electron: 11.0.1