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

235
Visualizações
clickable transparent window in electron

I am trying to make a transparent window in Electron. So far, I'm able to solve and find the solutions to every problem except for this one. I'm trying to make a transparent full-size browser window in electron which stays always on top of other windows so that I can draw the rectangle using the mouse to mimic screen selection.

This is my browserWindow

const createCanvasWindow = () => {
  // Create the browser window for screen selection.

  canvasWindow = new BrowserWindow({
    skipTaskbar: true,
    transparent: true,
    fullscreen: true,
    show: false,
    alwaysOnTop: true,
    frame: false,
    // opacity: 0.1,
    focusable: true,
    acceptFirstMouse: true,
    webPreferences: {
      preload: path.join(__dirname, './preloaders/canvas_preload.js')
    }
  });

  // canvasWindow.setIgnoreMouseEvents(false);
  // canvasWindow.setFocusable(true);

  canvasWindow.loadURL(`file://${__dirname}/templates/index.html`)
};

And inside the index.html script I have a JS function like this

document.onmousemove = function (e) {
            setMousePosition(e); // function to get mouse cordinates
        }

I'm able to create the transparent window but this doesn't catch any mouse click or mouse move event but the window beneath it does. And if I change the opacity to any value other than 0, I'm getting mouse events. I also tried to set canvasWindow.setIgnoreMouseEvents(false); and canvasWindow.setFocusable(true); but neither of them worked.

From the docs opacity doesn't work on Linux.

How can I make a fully transparent window which catches all mouse click move and keyboard events?

I'm using Electron 17.1.1, Windows 10, Node 16.14, and npm 7.19.

Any help would be appreciated.

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