Repository navigation
perf(desktop): let a minimized or hidden macOS window stop rendering - #10168
Conversation
#1190 turned background throttling off for the macOS window and added the disable-backgrounding-occluded-windows switch as an untested guard against GPU layer corruption. With throttling off, a minimized or hidden window still reported visible to the page and kept rendering at the display rate. Both overrides are removed, so macOS now behaves like Windows and Linux: a minimized or hidden window reports hidden, draws no frames, and has its timers throttled. The repaint on restore and show stays.
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Summary
webContents.setBackgroundThrottling(false)on the main window and thedisable-backgrounding-occluded-windowsswitch.restoreandshowstays.Why / Context
With background throttling off, a minimized window still reported
visibleand kept rendering at 120 Hz, spinners included. #1190 added both overrides as a guard against GPU layer corruption on macOS Sequoia; its description says testing was not run, and no issue is linked. Electron has gone from 39 to 44 since.setBackgroundThrottling(false)is the override that matters. Removing only the switch changed nothing in my test.Manual QA
Dev app from this branch on macOS (M5 Max, 120 Hz), driven over CDP.
Background work while minimized:
notifications.showNativemutation returned in 1 ms from the hidden renderer.CPU for the whole app while minimized with spinners running was 3.5% of one core in one 15 s sample, against 5.1% on main.
Behavior change to know about
Terminal output is written once per animation frame. A hidden window draws no frames, so output waits until 1 MB has built up or the window is shown again. In the burst test the last 0.8 MB arrived on restore; a small command's output did not reach the terminal buffer at all until restore. Nothing was lost in either case. Windows and Linux already work this way; this is new only for macOS.
Testing
bun run typecheckinapps/desktopbiome checkon the changed filesKnown Limitations
Rollback
Revert this PR; both overrides are self-contained.
Summary by cubic
Lets a minimized or hidden macOS window stop rendering by removing the background-throttling overrides added in #1190. A minimized or hidden macOS window now reports
hiddento the page and draws no frames, matching Windows and Linux behavior, while the repaint on restore and show is preserved.setBackgroundThrottling(false)from the main window and thedisable-backgrounding-occluded-windowsswitch.Behavior change to know about
Written for commit 1053486. Summary will update on new commits.
Summary by CodeRabbit