Does anyone know if it's possible to capture click events with Electron when setIgnoreMouseEvents is true? I'm using Electron as a transparent overlay, forwarding clicks to a background application. When the background application receives a click, I'd like to update the Electron app, but the click listener isn't firing. Here's the code:
index.js
const electron = require('electron');
const fetch = require('electron-fetch').default
const { app, BrowserWindow, session } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 3840,
height: 2160,
x: 0,
y: 0,
transparent: true,
frame: false,
alwaysOnTop: true,
focusable: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
}
})
win.setFocusable(false);
win.setIgnoreMouseEvents(true, { forward: true }), // forward clicks to background application
win.webContents.openDevTools();
win.loadFile('index.html')
}
app.on('ready', () => {
console.log('app is now ready');
createWindow();
});
index.js
const electron = require('electron');
const remote = require("electron").remote;
let win = remote.getCurrentWindow();
window.addEventListener("mousemove", event => {
console.log("mouse movements are detected")
});
window.addEventListener("click", event => {
console.log("how can I get this log statement to print in the console?") // never fires
});