Electron, VSCode & Mica Materials #209
Replies: 2 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
No worries, I'd be happy to explain what I know, though I didn't create the original Vibrancy project and as such my Electron knowledge is limited.
This line is indeed what sets the background to be semitransparent, you can see here how VSCode initially makes the window opaque here: https://github.com/microsoft/vscode/blob/9f8431f7fccf7a048531043eb6b6d24819482781/src/vs/platform/theme/electron-main/themeMainService.ts#L80 Although you might also need to call We also have these scripts that help with fixing this value on window resize,
You can replicate what Vibrancy Continued does and patch the workbench HTML and Electron JS files, though it's worth noting that you'll also have to deal with a variety of possible issues due to other extensions potentially also doing the same thing, as well as VSCode's integrity checks and CSP. You could also fork Vibrancy Continued and use it as a foundation for your own project, it is MIT licensed after all. If there's something that you'd like to see changed, you can also open a PR.
I'm unsure on how necessary the current native modules still are, given that
I'm not 100% sure, but from what I've read the color of this bar is system-controlled and isn't something that Electron can style, and VSCode on Windows has a custom implementation of it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@illixion I apologize for tagging you directly, but I feel like you would be in the best position to know. My experience with Electron is minimal and same with JavaScript in general.
If you have a moment, could you please with help my understanding of a few things?
window.setBackgroundColor('#00000000')
When it comes to making the Electron window of VSCode transparent (or black) so that it can accept materials like Mica and Acrylic, is the code (above) generally the "secret sauce" for doing that?
If Yes, is there any method that I can use to inject that line of code without using your extension or without using a compiled .NODE binary?
For example, would the Custom UI Style vscode extension allow for injecting this line where it needs to be?
The reason why I ask is because my own project Immersive UX currently requires users to install your extension and from there, my app applies any of the materials or blur to VSCode/VSCodium. My method is different since mine requires the native titlebar so our end goals are quite different.
From my understanding, my app only works with your extension because your extension is what allows for "punching through" the Electron layers so that backdrop materials can be seen through the Electron BrowserWindow. And that, I assume, is the
window.setBackgroundColor('#00000000')
line setting the alpha value.I just don't know how far I should go down this rabbit hole if it's not possible for me to achieve. So that is what I am hoping that you can clarify for me.
If you can help me to understand this better, I would really appreciate it. Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions