Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
Electron - Add click listener when setIgnoreMouseEvents is set to true?

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
  });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!