Skip to content

armgit / ente

Public Imported from GitHub
0

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

Ensure mergeability

Manav Rathie1633eccb731
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index d4a7e2214c..3ea105ef8b 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -9,16 +9,16 @@
* 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 {
BrowserWindow,
Menu,
Tray,
app,
dialog,
+ nativeTheme,
protocol,
+ type WebContents,
} from "electron/main";
import serveNextAt from "next-electron-server";
import { existsSync } from "node:fs";
@@ -326,6 +326,8 @@ const attachProcessHandlers = () => {
*/
const waitForRendererDevServer = () => wait(1000);
+const wipDesktopCustomTitlebar = process.env.ENTE_WIP_TITLEBAR == "1";
+
/**
* Create an return the {@link BrowserWindow} that will form our app's UI.
*
@@ -362,8 +364,12 @@ const createMainWindow = () => {
// do it (Step 2) unconditionally (i.e., on macOS too).
//
// https://www.electronjs.org/docs/latest/tutorial/custom-title-bar#create-a-custom-title-bar
- titleBarStyle: "hidden",
- titleBarOverlay: true,
+ ...(wipDesktopCustomTitlebar
+ ? {
+ titleBarStyle: "hidden",
+ titleBarOverlay: true,
+ }
+ : {}),
// The color to show in the window until the web content gets loaded.
// https://www.electronjs.org/docs/latest/api/browser-window#setting-the-backgroundcolor-property
//
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 48d0366771..14a0be8271 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -1,4 +1,9 @@
-import { clientPackageName, isDesktop, staticAppTitle } from "@/base/app";
+import {
+ clientPackageName,
+ isDesktop,
+ staticAppTitle,
+ wipDesktopCustomTitlebar,
+} from "@/base/app";
import { CenteredFlex } from "@/base/components/containers";
import { CustomHead } from "@/base/components/Head";
import {
@@ -187,7 +192,9 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<Notification {...notificationProps} />
- {isDesktop && <WindowTitlebar>{title}</WindowTitlebar>}
+ {wipDesktopCustomTitlebar && (
+ <WindowTitlebar>{title}</WindowTitlebar>
+ )}
<AppContext.Provider value={appContext}>
{!isI18nReady ? (
<LoadingOverlay />
@@ -210,6 +217,14 @@ const redirectToFamilyPortal = () =>
window.location.href = url;
});
+const WindowTitlebar: React.FC<React.PropsWithChildren> = ({ children }) => (
+ <WindowTitlebarArea>
+ <Typography variant="small" sx={{ mt: "2px", fontWeight: "bold" }}>
+ {children}
+ </Typography>
+ </WindowTitlebarArea>
+);
+
// See: [Note: Customize the desktop title bar]
const WindowTitlebarArea = styled(CenteredFlex)`
z-index: 10000;
@@ -221,11 +236,3 @@ const WindowTitlebarArea = styled(CenteredFlex)`
/* Allow using the titlebar to drag the window */
app-region: drag;
`;
-
-const WindowTitlebar: React.FC<React.PropsWithChildren> = ({ children }) => (
- <WindowTitlebarArea>
- <Typography variant="small" sx={{ mt: "2px", fontWeight: "bold" }}>
- {children}
- </Typography>
- </WindowTitlebarArea>
-);
diff --git a/web/packages/base/app.ts b/web/packages/base/app.ts
index 74b891a9c0..9dd56c1f35 100644
--- a/web/packages/base/app.ts
+++ b/web/packages/base/app.ts
@@ -40,6 +40,9 @@ export const appName: AppName = process.env.appName as AppName;
*/
export const isDesktop = process.env.isDesktop == "1";
+export const wipDesktopCustomTitlebar =
+ isDesktop && process.env.NEXT_PUBLIC_ENTE_WIP_TITLEBAR == "1";
+
/**
* Version of the desktop app.
*
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index 8d87180b8e..8bbab184af 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -10,7 +10,7 @@ import {
type DrawerProps,
} from "@mui/material";
import React from "react";
-import { isDesktop } from "../../app";
+import { wipDesktopCustomTitlebar } from "../../app";
import type { ModalVisibilityProps } from "../utils/modal";
/**
@@ -28,7 +28,7 @@ export const SidebarDrawer = styled(Drawer)(({ theme }) => ({
padding: theme.spacing(1),
// Add extra padding on the top to account for our inline title bar.
// See: [Note: Customize the desktop title bar]
- ...(isDesktop
+ ...(wipDesktopCustomTitlebar
? { paddingTop: "calc(env(titlebar-area-height) / 2 + 4px)" }
: {}),
},