Can't succeed in making transparent window in Electron (javascript)

后端 未结 4 2045
失恋的感觉
失恋的感觉 2020-12-18 22:06

I am trying to make a transparent window with ElectronJs but I obtain a black background.

I am on Linux (Debian Jessie)

I have tried different versions : lat

4条回答
  •  粉色の甜心
    2020-12-18 22:58

    I found a way to get it working! Try creating your window 10 milliseconds after Electron's ready, like this:

    app.on('ready', function () {
        setTimeout(function() {
            createWindow();
        }, 10);
    });
    

    Instead of: app.on('ready', createWindow);

    I found it from this Github post: https://github.com/electron/electron/issues/2170#issuecomment-361549395

    Also, you need to keep these command line flags for it to work: --enable-transparent-visuals --disable-gpu


    Unfortunately Electron doesn't support transparent windows on linux.

    I have actually tried a bunch of things to get it working but nothing has worked yet.

    Source: https://github.com/electron/electron/issues/8532#issuecomment-306383343

提交回复
热议问题