Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix the original issue

Manav Rathi320a397b1cf0
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index 9f17439d2c..f904152253 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -9,6 +9,7 @@
* https://www.electronjs.org/docs/latest/tutorial/process-model#the-main-process
*/
+import { nativeTheme } from "electron";
import { nativeImage, shell } from "electron/common";
import type { WebContents } from "electron/main";
import {
@@ -347,16 +348,18 @@ const createMainWindow = () => {
...(bounds ?? {}),
// Enforce a minimum size
...minimumWindowSize(),
- // Remove the default titlebar, we will render our own that better with
- // the theme. This is also a prerequisite to have a transparent
- // backgoundColor of the window during loading (we cannot use a fixed
- // color because it is theme dependent, and information about the
- // currently applicable theme is not available at this point).
+ // See: [Note: Customize the desktop title bar]
titleBarStyle: "hidden",
...(process.platform !== "darwin" ? { titleBarOverlay: true } : {}),
// The color to show in the window until the web content gets loaded.
- // See: https://www.electronjs.org/docs/latest/api/browser-window#setting-the-backgroundcolor-property
- backgroundColor: "black",
+ // https://www.electronjs.org/docs/latest/api/browser-window#setting-the-backgroundcolor-property
+ //
+ // To avoid a flash, we want to use the same background color as the
+ // theme of their choice. Unless the user has modified their preference
+ // to not follow the system, we can deduce it from the current OS theme.
+ //
+ // See: https://www.electronjs.org/docs/latest/tutorial/dark-mode
+ backgroundColor: nativeTheme.shouldUseDarkColors ? "black" : "white",
// We'll show it conditionally depending on `wasAutoLaunched` later.
show: false,
});