Compare commits

...
Author SHA1 Message Date
LukeParkerDev cfbff92fa7 perf(desktop): only persist the background colour when it changes
The renderer reports its theme background over IPC on every boot, and
electron-store rewrites and fsyncs opencode.settings on each set. That
blocked the main thread for ~40 ms while the renderer was waiting on
IPC during startup, for a value that had not changed.
2026-09-18 23:14:09 +10:00
@@ -58,8 +58,10 @@ export function setDockIcon(path: Path.Path, paths: DesktopPaths.Resolved) {
}
export function setBackgroundColor(color: string) {
// The renderer reports its theme background on every boot; electron-store rewrites and fsyncs the
// settings file on each set, so only persist a change.
if (getBackgroundColor() !== color) getStore().set(BACKGROUND_COLOR_KEY, color)
backgroundColor = color
getStore().set(BACKGROUND_COLOR_KEY, color)
BrowserWindow.getAllWindows().forEach((win) => {
win.setBackgroundColor(color)
if (process.platform === "darwin") win.invalidateShadow()