Skip to content

Commit f85e61d

Browse files
joohwcursoragent
andcommitted
release(desktop): v0.1.5 with unified title bar branding
Match the Windows title bar to the app background, show version in the window title, and bump the desktop shell to 0.1.5. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c8e1e62 commit f85e61d

6 files changed

Lines changed: 57 additions & 21 deletions

File tree

electron/main.js

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,44 @@ let quitting = false;
4444
const THEME_STORAGE_KEY = "clovapi-theme";
4545
/** Matches renderer page background (title bar flash before paint). */
4646
const WINDOW_BG_TOP = "#FBF9F9";
47+
const TITLE_BAR_OVERLAY_HEIGHT = 32;
48+
49+
function windowTitle() {
50+
return `ClovAPI Switcher v${app.getVersion()}`;
51+
}
52+
53+
function buildBrowserWindowOptions() {
54+
const options = {
55+
width: 700,
56+
height: 760,
57+
minWidth: 640,
58+
minHeight: 560,
59+
autoHideMenuBar: true,
60+
backgroundColor: WINDOW_BG_TOP,
61+
icon: windowIconPath(),
62+
title: windowTitle(),
63+
webPreferences: {
64+
preload: path.resolve(__dirname, "preload.js"),
65+
contextIsolation: true,
66+
nodeIntegration: false,
67+
sandbox: false,
68+
},
69+
};
70+
71+
if (process.platform === "win32") {
72+
options.titleBarStyle = "hidden";
73+
options.titleBarOverlay = {
74+
color: WINDOW_BG_TOP,
75+
symbolColor: "#353535",
76+
height: TITLE_BAR_OVERLAY_HEIGHT,
77+
};
78+
options.backgroundMaterial = "none";
79+
} else if (process.platform === "darwin") {
80+
options.titleBarStyle = "hiddenInset";
81+
}
82+
83+
return options;
84+
}
4785
let coreDevWatcher = null;
4886
let coreDevRestartTimer = null;
4987

@@ -338,22 +376,7 @@ function createTray() {
338376
}
339377

340378
function createWindow() {
341-
mainWindow = new BrowserWindow({
342-
width: 700,
343-
height: 760,
344-
minWidth: 640,
345-
minHeight: 560,
346-
autoHideMenuBar: true,
347-
backgroundColor: WINDOW_BG_TOP,
348-
icon: windowIconPath(),
349-
title: "ClovAPI Switcher",
350-
webPreferences: {
351-
preload: path.resolve(__dirname, "preload.js"),
352-
contextIsolation: true,
353-
nodeIntegration: false,
354-
sandbox: false,
355-
},
356-
});
379+
mainWindow = new BrowserWindow(buildBrowserWindowOptions());
357380
if (isElectronDev) {
358381
mainWindow.webContents.on("preload-error", (_event, preloadPath, error) => {
359382
emitOutput("stderr", `[dev] preload failed (${preloadPath}): ${error?.message || error}\n`);

electron/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

electron/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "clovapi-switcher",
33
"private": true,
4-
"version": "0.1.4",
4+
"version": "0.1.5",
55
"description": "ClovAPI Switcher desktop app",
66
"main": "main.js",
77
"type": "commonjs",

electron/ui/src/App.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@
5656
</div>
5757
{/if}
5858

59-
<main class="mx-auto flex min-h-svh w-full max-w-3xl flex-col px-5 py-5">
60-
<header class="mb-5 shrink-0">
59+
<main
60+
class="mx-auto flex min-h-svh w-full max-w-3xl flex-col px-5 py-5 {inElectron ? 'electron-window-chrome' : ''}"
61+
>
62+
<header class="mb-5 shrink-0 {inElectron ? 'electron-titlebar-drag' : ''}">
6163
<h1 class="text-lg font-semibold tracking-tight">ClovAPI Switcher</h1>
6264
<p class="mt-1 text-xs text-muted-foreground">{copy.subtitle}</p>
6365
</header>

electron/ui/src/app.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@
9595
"Microsoft YaHei",
9696
sans-serif;
9797
}
98+
99+
.electron-window-chrome {
100+
padding-top: env(titlebar-area-height, 32px);
101+
}
102+
103+
.electron-titlebar-drag {
104+
-webkit-app-region: drag;
105+
}
98106
}
99107

100108
[data-sonner-toaster] {

electron/ui/src/lib/store/app-version.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export async function refreshAppVersion() {
2626
try {
2727
const version = await window.clovapiEnv?.getVersion?.();
2828
store.appVersion = String(version || "").trim();
29+
if (store.appVersion) {
30+
document.title = `ClovAPI Switcher v${store.appVersion}`;
31+
}
2932
} catch {
3033
store.appVersion = "";
3134
}

0 commit comments

Comments
 (0)