feat(app): native integrated title bar + draggable chrome

macOS uses titleBarStyle hiddenInset so the traffic lights float over
the sidebar (Linear/Hermes-style), with the sidebar top inset to clear
them and the top chrome marked -webkit-app-region: drag (interactive
controls stay no-drag). Windows/Linux keep their native frame + controls.
Exposes process.platform through the bridge and tags <html data-platform>
so CSS adapts per OS. typecheck + 82 tests green.
This commit is contained in:
iamtoruk 2026-07-11 08:51:24 -07:00
parent 51e47112ca
commit 6775592716
5 changed files with 25 additions and 0 deletions

View file

@ -150,6 +150,9 @@ function createWindow(): BrowserWindow {
minWidth: 900,
minHeight: 600,
backgroundColor: nativeTheme.shouldUseDarkColors ? '#0e1013' : '#f5f6f8',
// macOS: integrated title bar (traffic lights float over the sidebar), like
// Linear/Hermes. Windows/Linux keep their native frame + window controls.
titleBarStyle: process.platform === 'darwin' ? 'hiddenInset' : 'default',
show: false,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),

View file

@ -27,6 +27,7 @@ const bridge = {
getShareStatus: () => invoke('codeburn:getShareStatus'),
getIdentity: () => invoke('codeburn:getIdentity'),
cliStatus: () => invoke('codeburn:cliStatus'),
platform: process.platform,
}
contextBridge.exposeInMainWorld('codeburn', bridge)

View file

@ -363,6 +363,7 @@ export interface CodeburnBridge {
getOverview(period: Period, provider: string): Promise<MenubarPayload>
getPlans(period: Period): Promise<StatusJson>
getActReport(): Promise<ActReportJson>
readonly platform: string
getModels(period: Period, provider: string, byTask: boolean): Promise<ModelReportRow[]>
getYield(period: Period): Promise<YieldJsonReport>
getSpendFlow(period: Period, provider: string): Promise<SpendFlow>

View file

@ -8,6 +8,11 @@ import './styles/plain.css'
const root = document.getElementById('root')
if (!root) throw new Error('#root not found')
// Tag the platform so CSS can adapt native chrome (macOS hiddenInset insets +
// drag regions); harmless when the bridge is absent (tests/jsdom).
document.documentElement.dataset.platform =
(window as unknown as { codeburn?: { platform?: string } }).codeburn?.platform ?? ''
createRoot(root).render(
<StrictMode>
<App />

View file

@ -101,6 +101,21 @@ body { overflow: hidden; background: var(--bg); color: var(--ink); }
/* Use the real OS window controls, not the wireframe's fake traffic-light dots. */
.lights { display: none; }
.sb { padding-top: 12px; }
/* macOS integrated title bar (hiddenInset): clear the traffic lights and make
the top chrome draggable, keeping interactive controls clickable. */
:root[data-platform='darwin'] .sb { padding-top: 34px; -webkit-app-region: drag; }
:root[data-platform='darwin'] .bar { -webkit-app-region: drag; }
:root[data-platform='darwin'] .sb .ni,
:root[data-platform='darwin'] .sb .status,
:root[data-platform='darwin'] .sb a,
:root[data-platform='darwin'] .sb button,
:root[data-platform='darwin'] .bar .seg,
:root[data-platform='darwin'] .bar .pop,
:root[data-platform='darwin'] .bar button,
:root[data-platform='darwin'] .bar a,
:root[data-platform='darwin'] .bar input,
:root[data-platform='darwin'] .bar [role='button'] { -webkit-app-region: no-drag; }
.app b { background: none; color: var(--accent); filter: none; }
.ni.on { background: var(--hover); color: var(--t1); box-shadow: none; }
.ni.on::before { background: var(--accent); }