mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-06 03:20:39 +08:00
feat(desktop): use the native macOS title bar
This commit is contained in:
@@ -30,8 +30,8 @@ const transactionFile = path.join(userRoot, 'upgrade.json');
|
||||
const interfaceFile = path.join(runtimeHome, 'data/user/settings/interface.json');
|
||||
const seed = app.isPackaged ? path.join(process.resourcesPath, 'seed/runtime.json') : path.join(sourceDirectory, '../.local', targetId(), 'seed/runtime.json');
|
||||
const publicKey = await readFile(path.join(sourceDirectory, '../assets/runtime-public.pem'), 'utf8');
|
||||
// macOS draws its 44px bar under the traffic lights; Windows uses a 38px WCO bar matching the sidebar tone.
|
||||
const HEADER_HEIGHT = WINDOWS ? 38 : 44;
|
||||
// The native macOS frame already excludes the title bar from the content bounds.
|
||||
const HEADER_HEIGHT = WINDOWS ? 38 : 0;
|
||||
// Once loaded, solid themes use the sampled sidebar color. The glass gradient
|
||||
// keeps the fallback color for the window chrome.
|
||||
const PALETTE_BACKGROUND = WINDOWS
|
||||
@@ -872,9 +872,7 @@ else {
|
||||
window = new BrowserWindow({
|
||||
title: 'Open DeepTutor', width: 1360, height: 920, minWidth: 900, minHeight: 620,
|
||||
backgroundColor: currentChromeBackground(),
|
||||
...(WINDOWS
|
||||
? { titleBarStyle: 'hidden', titleBarOverlay: titleBarOverlayOptions(ui.theme) }
|
||||
: { titleBarStyle: 'hiddenInset', trafficLightPosition: { x: 18, y: 16 } }),
|
||||
...(WINDOWS && { titleBarStyle: 'hidden', titleBarOverlay: titleBarOverlayOptions(ui.theme) }),
|
||||
webPreferences: { preload: path.join(sourceDirectory, 'preload.cjs'), contextIsolation: true, sandbox: true, nodeIntegration: false },
|
||||
});
|
||||
window.webContents.on('will-navigate', event => event.preventDefault());
|
||||
|
||||
@@ -119,6 +119,8 @@ body {
|
||||
:root[data-phase="ready"] .titlebar { border-bottom-color: var(--line); }
|
||||
:root[data-phase="ready"] .titlebar-name { opacity: .88; }
|
||||
|
||||
:root:not([data-platform="win32"]) .titlebar { display: none; }
|
||||
|
||||
/* Windows inline menu bar merged into the WCO title bar. */
|
||||
:root[data-platform="win32"] .titlebar {
|
||||
height: 38px;
|
||||
|
||||
Reference in New Issue
Block a user