electron: [v10.0.0] Failure of transparent in Linux
Preflight Checklist
- [ x] I have read the Contributing Guidelines for this project.
- [ x] I agree to follow the Code of Conduct that this project adheres to.
- [ x] I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
Transparent failed in v10.0.0 and v11.0.0-beta. 1, but normal in v4-v9.
const onAppReady = () =>{
let parent = new BrowserWindow({
width: 300,
height: 300,
transparent: true,
frame: true
})
parent.loadFile('main.html')
}
app.on('ready', () =>setTimeout(onAppReady, 500))
-
Electron Version: v10.0.0 and v11.0.0-beta.1
-
Operating System: x86_64 Linux version 5.4.50-amd64-desktop (deepin@deepin-PC) (gcc version 8.3.0 (Uos 8.3.0.3-3+rebuild))
-
Last Known Working Electron version: v9.2.1
Screenshots
v9.2.1
v10.0.0

Additional Information
I have tested v4/v5/v9 are normal, only v10 - v11 failed.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 20 (5 by maintainers)
Commits related to this issue
- Rollback Electron to 9.x series since 10.x has an issue with Linux transparency More details: https://github.com/electron/electron/issues/25153 — committed to NyaomiDEV/Glasstron by deleted user 4 years ago
- Electron update (12.0.9 does support transparancy again!) see https://github.com/electron/electron/issues/25153#issuecomment-843688494 — committed to mafflerbach/webrpc_mpv by deleted user 3 years ago
- Electron update (12.0.9 does support transparancy again!) see electron/electron/issues/25153#issuecomment-843688494 — committed to mafflerbach/webrpc_mpv by deleted user 3 years ago
I was trying to get vscode transparency working without
--disable-gpuand decided to try--use-gl=desktopand to my surprise it worked. I couldn’t get it to work on a smaller test project though and I didn’t have to patience to start debugging. Just decided to share this is it happens to help anyone!And below are chrome://gpu from with and without
--use-gl=desktop(may be of some use so might as well share them) With: https://gist.github.com/Xaryphon/8e881d7beccc88c2ba27fe3bdb271c38 Without: https://gist.github.com/Xaryphon/282f8ec13d291b626db95bec5d59a497This will disable hardware acceleration and it is not ideal if the application you are trying to develop is rather heavy in content. Nobody wants laggy applications. This should be solved regardless of workarounds imo
After several tests between v9 and v10, it is found that:
v10.0.0-beta.4 correct. v10.0.0-beta.8 failed.
2021-7: Confirm following code works on
Code:
Observations:
app.on('ready', createWindow)won’t create a transparent windowapp.disableHardwareAcceleration();, I can reducecreateWindowdelay to about 20 (ms).app.disableHardwareAcceleration();, I can reducecreateWindowdelay to about 120 (ms).transparent: trueapp.commandLine.appendSwitch('use-gl','desktop');app.on('ready', () => setTimeout(createWindow, 500))As you said, it is a workaround. The best way to close this ticket would be to have Electron use this newfound flag automatically if a transparent window is created on Linux, without us even remotely thinking about having to use it on our own.
Did’nt fully finished this regression, but I was able to find this was between bump of chromium from 85.0.4168.1 (included) and bump of chromium 85.0.4178.4 (included)
Seems the only way to work around this is by stopping HW acceleration before the app is ready. Something in the lines of:
_Originally posted by @andredezzy in https://github.com/electron/electron/issues/2170#issuecomment-736223269_
Just wanted to mention that NW.js had this problem/regression too , but recently they updated chromium to version 86.0.4240.75 and the transparency in linux now works correctly
@ckerr These are the screenshots from my test. (Linux-deepin v20)
10.1.3 We are using Node.js 12.16.3, Chromium 85.0.4183.121, and Electron 10.1.3.
10.0.0-beta.4 We are using Node.js 12.16.3, Chromium 85.0.4161.2, and Electron 10.0.0-beta.4.