Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(desktop):codex-reports

Aswin Asok32e8132c2105
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index b4febf946e..cece239a58 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -167,10 +167,9 @@ const createMainWindow = () => {
path.join(isDev ? "build" : process.resourcesPath, "window-icon.png"),
);
const bounds = windowBounds();
- const themeMode = userPreferences.get("themeMode");
- const shouldUseDarkColors =
- themeMode == "dark" ||
- (themeMode != "light" && nativeTheme.shouldUseDarkColors);
+ const themeMode = userPreferences.get("themeMode") ?? "system";
+ nativeTheme.themeSource = themeMode;
+ const shouldUseDarkColors = nativeTheme.shouldUseDarkColors;
const window = new BrowserWindow({
webPreferences: {
@@ -180,8 +179,6 @@ const createMainWindow = () => {
icon,
...(bounds ?? {}),
...minimumWindowSize(),
- // Linux uses its native frame. The overlay remains enabled elsewhere
- // so the renderer receives its CSS dimensions.
...(process.platform == "linux"
? {}
: {
@@ -196,7 +193,6 @@ const createMainWindow = () => {
}
: true,
}),
- // Match the initial paint to the selected theme to avoid a flash.
backgroundColor: shouldUseDarkColors ? "black" : "white",
show: false,
});
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 6ba3aa0398..c4437aacbe 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -280,21 +280,19 @@ export const attachMainWindowIPCHandlers = (mainWindow: BrowserWindow) => {
"setTitleBarOverlay",
(_, themeMode: unknown, isFileViewerOpen: unknown) => {
if (
- (themeMode != "light" &&
- themeMode != "dark" &&
- themeMode != "system") ||
- typeof isFileViewerOpen != "boolean"
+ themeMode !== "light" &&
+ themeMode !== "dark" &&
+ themeMode !== "system"
)
return;
+ if (typeof isFileViewerOpen != "boolean") return;
userPreferences.set("themeMode", themeMode);
+ nativeTheme.themeSource = themeMode;
if (process.platform != "win32") return;
- const isDarkTheme =
- themeMode == "dark" ||
- (themeMode == "system" && nativeTheme.shouldUseDarkColors);
- const isDark = isDarkTheme || isFileViewerOpen;
+ const isDark = nativeTheme.shouldUseDarkColors || isFileViewerOpen;
mainWindow.setTitleBarOverlay({
color: isDark ? "black" : "white",
symbolColor: isDark ? "#cdcdcd" : "black",
diff --git a/web/apps/photos/src/pages/large-files.tsx b/web/apps/photos/src/pages/large-files.tsx
index 7a363382b9..5e123e6592 100644
--- a/web/apps/photos/src/pages/large-files.tsx
+++ b/web/apps/photos/src/pages/large-files.tsx
@@ -35,6 +35,7 @@ import {
computeThumbnailGridLayoutParams,
type ThumbnailGridLayoutParams,
} from "ente-new/photos/components/utils/thumbnail-grid-layout";
+import { usePhotosAppContext } from "ente-new/photos/types/context";
import { t } from "i18next";
import { useRouter } from "next/router";
import React, {
@@ -54,6 +55,7 @@ import {
const Page: React.FC = () => {
const { showMiniDialog, onGenericError } = useBaseContext();
+ const { setIsFileViewerOpen } = usePhotosAppContext();
const [state, dispatch] = useReducer(
largeFilesReducer,
@@ -112,14 +114,21 @@ const Page: React.FC = () => {
});
}, [showMiniDialog, onGenericError, state.largeFiles]);
- const handleOpenViewer = useCallback((index: number) => {
- setCurrentIndex(index);
- setOpenFileViewer(true);
- }, []);
+ const handleOpenViewer = useCallback(
+ (index: number) => {
+ setCurrentIndex(index);
+ setOpenFileViewer(true);
+ setIsFileViewerOpen?.(true);
+ },
+ [setIsFileViewerOpen],
+ );
const handleCloseViewer = useCallback(() => {
setOpenFileViewer(false);
- }, []);
+ setIsFileViewerOpen?.(false);
+ }, [setIsFileViewerOpen]);
+
+ useEffect(() => () => setIsFileViewerOpen?.(false), [setIsFileViewerOpen]);
const files = useMemo(
() => state.largeFiles.map((item) => item.file),