EYHN / vscode-vibrancy

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

Blinking when toggle panels #114

Open xMalikeNx opened 3 years ago

xMalikeNx commented 3 years ago

Hi i have an issue when toggling panels.

Is there way to avoid it?

https://user-images.githubusercontent.com/68480258/128751202-4a8ee2a6-1dfe-47e8-b3ca-6234b431da57.mov

dr1verrr commented 3 years ago

Same

brandon-powell commented 2 years ago

After digging through the source, this appears to be the result of vscode resetting the window background color and Vibrancy trying to fix that with a timer.

You can play with the timer here to get the blink down to acceptable levels. Until a better workaround can be found. https://github.com/EYHN/vscode-vibrancy/blob/d2f3c95a7b8e1afd09b0ee1d196c8bf164c5e591/runtime/index.js#L86-L90

The blink is just a factor of the time between the color being set and the timer firing off afterwards to reset it, so its a tradeoff between how many times you want to unnecessarily reset the background color of the window vs how much it bugs you. I've found that it starts getting tolerable around 10ms and is virtually eliminated around 1-2 ms.

Note, it may be easiest to edit that file manually in it's install location (which was /Applications/Visual Studio Code.app/Contents/Resources/app/out/vscode-vibrancy-runtime-v6 for me), as Vibrancy has a directory exists check that keeps it from overwriting those files if you don't uninstall first.

brandon-powell commented 2 years ago

More performant fix: Disable the timer mentioned in my previous comment, and find the following file (path shown for default installation on macOS): /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js In that file, there is a section that contains:

updateBackgroundColor(d,g){for(const b of p.BrowserWindow.getAllWindows())if(b.id===d){b.setBackgroundColor(g.colorInfo.background);break}}

Replace that with:

updateBackgroundColor(d,g){for(const b of p.BrowserWindow.getAllWindows())if(b.id===d){b.setBackgroundColor("#00000000");break}}

Now the background color should persist without the timer and without a blink (at least until this file is overwritten by a VSCode update, at which point you'll have to reapply the patch).

e-simpson commented 2 years ago

Thanks for the insight @brandon-powell.

Just for reference, in the current build the lines appear in /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js as:

updateBackgroundColor(t,m){for(const v of p.BrowserWindow.getAllWindows())if(v.id===t){v.setBackgroundColor(m.colorInfo.background);break}}

and should be replaced with:

updateBackgroundColor(t,m){for(const v of p.BrowserWindow.getAllWindows())if(v.id===t){v.setBackgroundColor("#00000000");break}}
chrisge78 commented 2 years ago

More performant fix: Disable the timer mentioned in my previous comment, and find the following file (path shown for default installation on macOS): /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js In that file, there is a section that contains:

updateBackgroundColor(d,g){for(const b of p.BrowserWindow.getAllWindows())if(b.id===d){b.setBackgroundColor(g.colorInfo.background);break}}

Replace that with:

updateBackgroundColor(d,g){for(const b of p.BrowserWindow.getAllWindows())if(b.id===d){b.setBackgroundColor("#00000000");break}}

Now the background color should persist without the timer and without a blink (at least until this file is overwritten by a VSCode update, at which point you'll have to reapply the patch).

Thank you very much!