mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
perf(desktop): only persist the background colour when it changes (#49770)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user