illixion / vscode-vibrancy-continued

Enable Acrylic/Glass effect for your VS Code.
MIT License
544 stars 31 forks source link

Only transparent when vscode window focused #36

Closed 1zumii closed 1 year ago

1zumii commented 1 year ago

focused

unfocused

illixion commented 1 year ago

I think standard macOS windows lose transparency in the background as well, so this could be intentional Electron behavior. I’m not sure how much time I can invest into investigating this, so if someone wants to help look into this, I’d appreciate it.

ynsgnr commented 1 year ago

I thik this works as intended, its the same as windows terminal which is also losing vibrancy on window bar when its not in focus, Windows OS only allows vibrancy when in focus

earlAchromatic commented 1 year ago

+1 MacOS terminal windows are always transparent and I would like the same behavior for VS Code. It's a bit distracting for such a big window to change transparency IMO and always switching from window to window when developing.

crumpeteer commented 1 year ago

+1 MacOS terminal windows are always transparent and I would like the same behavior for VS Code. It's a bit distracting for such a big window to change transparency IMO and always switching from window to window when developing.

That's a great point! Just tested this and can confirm that terminal doesn't change it's background when focus changes. I wish this extension worked that way. The switching is really annoying and I don't like how the theme looks with vibrancy off.

hjnnjh commented 1 year ago

So is there any way to implement transparent when VSCode window is unfocused?

tthn0 commented 1 year ago

I'm also having this issue on macOS

alperenkarip commented 1 year ago

same problem..

illixion commented 1 year ago

Everyone is currently experiencing this, no need to +1 unless you have something to add.

perigozin commented 1 year ago

I believe this is an Electron thing, I've been using Obsidian which is also Electron based and enabled the vibrancy through the console, it behaves exactly like this.

It could be a Windows related issue since the Terminal also has this behavior but if if macOS users are having the same issue it's probably on Electron's side.

RoyalFoxy commented 1 year ago

I have stumbled upon another issue from the old code base which got archived

https://github.com/EYHN/vscode-vibrancy/issues/127

This is the link to it

In short one comment searched the docs of electron and found out something that would enable vibrancy to be enabled all the time even without focus. This is for macos only btw.

The comment reads "This is probably happening since BrowserWindow.options.visualEffectState is presumably set to the default value of followWindow. Changing this to active should fix this.

I've figured this out by looking at the electron docs (Just ctrl+f for visualEffectState).

Unfortunately I have no idea how to access the options object of a BrowserWindow using an extension or if changing it after its creating is even possible. I'd appreciate if anyone with any knowledge about electron and vscode extensions could chime in."

So if there is an option to set the visualEffectState option to active in a vscode extension then this issue could be solved.

The link provided in the comment does not work and here is a working alternative to the new page that contains the info about visualEffectState https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions

illixion commented 1 year ago

This is a good find @RoyalFoxy, thanks for mentioning this option! Since we're updating VSCode files directly, I could make Vibrancy modify the /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js file to add this option to the BrowserWindow creation code. I've tested this locally and it does seems to work as expected.

illixion commented 1 year ago

I've published v1.1.19 which fixes this issue, closing as completed.

1zumii commented 1 year ago

i already update to v1.1.19, but code window still lost transparency when not focus

image

there is my vscode info

Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T15:00:40.428Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: Yes
illixion commented 1 year ago

Thanks for letting me know @izumiiAoba, there was an implementation bug that I didn't notice, fixed it and verified that this works properly now.

1zumii commented 1 year ago

sincerely appreciate your work, but problem still exists even update to v1.1.20. perhaps it's caused by my VS Code version or some other dependencies?

illixion commented 1 year ago

sincerely appreciate your work, but problem still exists even update to v1.1.20. perhaps it's caused by my VS Code version or some other dependencies?

If you have any other extensions that modify VSCode's files, then that's a possibility, I've seen some custom CSS loaders cause issues with Vibrancy for instance.

Could you try opening /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js and searching for visualEffectState:"active"? It should be next to experimentalDarkMode:!0, and that change is what enables background transparency. If it's missing, you may need to try reloading Vibrancy again.

tthn0 commented 1 year ago

I uninstalled and reinstalled vibrancy, and I no longer have this bug on v1.1.20 now.

1zumii commented 1 year ago

and searching for visualEffectState:"active"

this setting is active

image

I uninstalled and reinstalled vibrancy, and I no longer have this bug on v1.1.20 now.

i tried uninstall and install, and works properly🥳 thanks again illixion, tthn0