Skip to content

Commit e371847

Browse files
committed
Fix duplicate backgroundColor after rebase and format EditorPanel
1 parent cddee3a commit e371847

2 files changed

Lines changed: 7 additions & 31 deletions

File tree

apps/desktop/src/main.ts

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -512,26 +512,6 @@ function ensureInitialBackendWindowOpen(): void {
512512
backendInitialWindowOpenInFlight = nextOpen;
513513
}
514514

515-
function getDesktopWindowBackgroundColor(): string {
516-
return nativeTheme.shouldUseDarkColors
517-
? DESKTOP_WINDOW_BACKGROUND_DARK
518-
: DESKTOP_WINDOW_BACKGROUND_LIGHT;
519-
}
520-
521-
function applyDesktopWindowBackground(window: BrowserWindow): void {
522-
if (window.isDestroyed()) {
523-
return;
524-
}
525-
526-
window.setBackgroundColor(getDesktopWindowBackgroundColor());
527-
}
528-
529-
function syncAllDesktopWindowBackgrounds(): void {
530-
for (const window of BrowserWindow.getAllWindows()) {
531-
applyDesktopWindowBackground(window);
532-
}
533-
}
534-
535515

536516
function writeDesktopStreamChunk(
537517
streamName: "stdout" | "stderr",
@@ -1722,7 +1702,7 @@ function registerIpcHandlers(): void {
17221702
}
17231703

17241704
nativeTheme.themeSource = theme;
1725-
syncAllDesktopWindowBackgrounds();
1705+
syncAllWindowAppearance();
17261706
});
17271707

17281708
ipcMain.removeHandler(CONTEXT_MENU_CHANNEL);
@@ -1893,7 +1873,9 @@ function getIconOption(): { icon: string } | Record<string, never> {
18931873
}
18941874

18951875
function getInitialWindowBackgroundColor(): string {
1896-
return nativeTheme.shouldUseDarkColors ? "#0a0a0a" : "#ffffff";
1876+
return nativeTheme.shouldUseDarkColors
1877+
? DESKTOP_WINDOW_BACKGROUND_DARK
1878+
: DESKTOP_WINDOW_BACKGROUND_LIGHT;
18971879
}
18981880

18991881
function getWindowTitleBarOptions(): WindowTitleBarOptions {
@@ -1934,7 +1916,6 @@ function syncAllWindowAppearance(): void {
19341916
}
19351917
}
19361918

1937-
nativeTheme.on("updated", syncAllWindowAppearance);
19381919

19391920
function createWindow(): BrowserWindow {
19401921
const window = new BrowserWindow({
@@ -1944,9 +1925,8 @@ function createWindow(): BrowserWindow {
19441925
minHeight: 620,
19451926
show: false,
19461927
autoHideMenuBar: true,
1947-
backgroundColor: getInitialWindowBackgroundColor(),
19481928
...getIconOption(),
1949-
backgroundColor: getDesktopWindowBackgroundColor(),
1929+
backgroundColor: getInitialWindowBackgroundColor(),
19501930
title: APP_DISPLAY_NAME,
19511931
...getWindowTitleBarOptions(),
19521932
webPreferences: {
@@ -2139,7 +2119,7 @@ app
21392119
configureAppIdentity();
21402120
configureApplicationMenu();
21412121
registerDesktopProtocol();
2142-
nativeTheme.on("updated", syncAllDesktopWindowBackgrounds);
2122+
nativeTheme.on("updated", syncAllWindowAppearance);
21432123
configureAutoUpdater();
21442124
void bootstrap().catch((error) => {
21452125
if (isBackendReadinessAborted(error) && isQuitting) {

apps/web/src/components/EditorPanel.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ const EditorPanel = memo(function EditorPanel({
9090
</div>
9191
}
9292
>
93-
<MonacoEditor
94-
environmentId={environmentId}
95-
cwd={cwd}
96-
relativePath={activeFilePath}
97-
/>
93+
<MonacoEditor environmentId={environmentId} cwd={cwd} relativePath={activeFilePath} />
9894
</Suspense>
9995
</div>
10096
</div>

0 commit comments

Comments
 (0)