Skip to content

Conversation

@avarayr
Copy link
Contributor

@avarayr avarayr commented Sep 22, 2025

Summary

Fixes #267022
Fixes #267065

related: electron/electron#48311

macOS Darwin 26 (Tahoe) has a WindowServer bug that causes (some?) windows with shadows to consume 80%+ GPU resources. This change disables VSCode window shadows specifically for Darwin 25.x to work around the performance regression.

Changes

  • Added version check in defaultBrowserWindowOptions to detect Darwin 25.x
  • Set options.hasShadow = false only on affected macOS versions
  • Applied fix centrally to ensure all VSCode windows are affected consistently

Testing

  • Tested on macOS Tahoe - GPU usage drops significantly - from constant 80% to normal 15%

Notes

This is a temporary workaround until Apple fixes the underlying WindowServer bug in macOS Tahoe. The version check can be refined or removed once the OS-level issue is resolved.

… issues

Fixes microsoft#267022

macOS Darwin 25.x (Tahoe) has a WindowServer bug that causes windows with
shadows to consume 80%+ GPU resources. This change disables window shadows
specifically for Darwin 25.x to work around the performance regression.

The fix is applied in defaultBrowserWindowOptions to ensure all VSCode
windows are affected consistently.
Copilot AI review requested due to automatic review settings September 22, 2025 00:49
@avarayr avarayr changed the title fix: disable window shadows on macOS Tahoe to prevent GPU performance issues Fix: Disable window shadows on macOS Tahoe to prevent GPU performance issues Sep 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes severe GPU performance issues on macOS Tahoe (Darwin 26) by disabling window shadows as a workaround for a WindowServer bug that causes 80%+ GPU usage.

  • Adds OS version detection to identify affected macOS versions
  • Disables window shadows specifically for Darwin 25.x systems
  • Centralizes the fix in defaultBrowserWindowOptions to affect all VS Code windows

options.acceptFirstMouse = false;
}

// Mac OS 26.?.? has a `WindowServer` bug that causes windows with shadows to cause 80%+ GPU load
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment incorrectly states 'Mac OS 26.?.?' but the code checks for osMajorVersion === 25. According to the PR description, the issue affects Darwin 26 (Tahoe), but the version check targets Darwin 25. This mismatch needs to be corrected.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@avarayr avarayr Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.release() returns the kernel version 25.0.0, which is not the same as the marketing version - Mac OS 26.0
Since this bug is most likely in windowserver, which is a userland program, the underlying issue is likely to be fixed with a patch update to the OS version, whereas the kernel version will remain the same 25.0.0

Question: Since this is potentially unreliable, but short of running sw_vers -productVersion there is no other option, is it worth to add a check with sw_vers -productVersion for this?

const [osMajorVersion, _osMinorVersion, _osPatchVersion] = release().split('.', 3).map(Number);

// In the future: once the bug is fixed in the OS, lock this into a specific version
if (osMajorVersion === 25) {
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version check targets Darwin 25, but according to the PR description and title, the issue affects macOS Tahoe which is Darwin 26. The condition should be osMajorVersion === 26 to match the intended target version.

Suggested change
if (osMajorVersion === 25) {
if (osMajorVersion === 26) {

Copilot uses AI. Check for mistakes.
@f0rr0
Copy link

f0rr0 commented Sep 22, 2025

is it possible to disable this via settings by any chance for existing builds?

@avarayr
Copy link
Contributor Author

avarayr commented Sep 22, 2025

✅ UPDATE — BETTER WORKAROUND ¹

launchctl setenv CHROME_HEADLESS 1

restart electron apps

(this will not survive computer reboots!)

¹ Why this works — chromium source code


Old method - patching (don't use)

for VSCode

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/main.js

for Cursor

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Cursor.app/Contents/Resources/app/out/main.js

You will need to re-run this on every update!

@ToxicLand
Copy link

is it possible to disable this via settings by any chance for existing builds?

nope, but you can run this in terminal in the meantime to patch it

for VSCode

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/main.js

for Cursor

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Cursor.app/Contents/Resources/app/out/main.js

You will need to re-run this on every update!

This is probably off-topic, but is there a solution like this for Discord? It uses an app.asar file.

@tunglt1810
Copy link

tunglt1810 commented Sep 23, 2025

✅ UPDATE — BETTER WORKAROUND ¹

launchctl setenv CHROME_HEADLESS 1

restart electron apps

(this will not survive computer reboots!)

¹ Why this works — chromium source code

Old method - patching

for VSCode

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/main.js

for Cursor

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Cursor.app/Contents/Resources/app/out/main.js

You will need to re-run this on every update!

you are god, my battery loves you

@merlinaudio
Copy link

@f0rr0 You may be able to use the "Custom UI" extension (or anything like it) to remove window shadows/window decorations. Alternatively, I think you can just fullscreen your vscode (cmd+ctrl+f) and the GPU usage issue should no longer occur

@Manouchehri
Copy link

For the lazy copy/paste people like myself, here's the command for VS Code Insiders:

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Visual\ Studio\ Code\ -\ Insiders.app/Contents/Resources/app/out/main.js

Copy link
Collaborator

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating the bug in upstream and creating this PR!

@deepak1556 deepak1556 added this to the September 2025 milestone Sep 24, 2025
@deepak1556 deepak1556 enabled auto-merge (squash) September 24, 2025 17:11
@deepak1556 deepak1556 merged commit e278d3a into microsoft:main Sep 24, 2025
17 checks passed
deepak1556 added a commit that referenced this pull request Oct 1, 2025
deepak1556 added a commit that referenced this pull request Oct 2, 2025
* Revert "Fix: Disable window shadows on macOS Tahoe to prevent GPU performance issues (#267724)"

This reverts commit e278d3a.

* chore: bump electron@37.6.0

* chore: update build
@jorgegarba
Copy link

✅ UPDATE — BETTER WORKAROUND ¹

launchctl setenv CHROME_HEADLESS 1

restart electron apps

(this will not survive computer reboots!)

¹ Why this works — chromium source code

Old method - patching (don't use)

for VSCode

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/main.js

for Cursor

sed -i '' 's/experimentalDarkMode:!0}/experimentalDarkMode:!0,hasShadow:false}/g' /Applications/Cursor.app/Contents/Resources/app/out/main.js

You will need to re-run this on every update!

Thank you from Perú 🇵🇪
I was close to downgrading the OS I thought my line codes were inefficient; I mean, it is possible, but not in that way Lol.
Regards

@claytonolley
Copy link

@jorgegarba this is fixed in the latest vs code release. Also, I'm not sure if Apple has changed anything about this issue in particular but I'm having far fewer problems in macos 26.1 beta.

@jorgegarba
Copy link

@jorgegarba this is fixed in the latest vs code release. Also, I'm not sure if Apple has changed anything about this issue in particular but I'm having far fewer problems in macos 26.1 beta.

TY sir!, Actually I have the latest version about VScode, yesterday night my laptop was burning, with this line today morning , I started the work and so far it is stable 😃

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Nov 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

10 participants