Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

308
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda