Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(desktop): drop the macOS title strip with a native drag region (#2179)

Maxbdc5c29cfd2d
diff --git a/desktop/Cargo.lock b/desktop/Cargo.lock
index 0b8d7b163..4c4a2027a 100644
--- a/desktop/Cargo.lock
+++ b/desktop/Cargo.lock
@@ -239,8 +239,11 @@ version = "0.1.0"
dependencies = [
"async-trait",
"avibe-runtime-host",
+ "block2",
"objc2",
+ "objc2-app-kit",
"objc2-foundation",
+ "objc2-web-kit",
"serde",
"serde_json",
"sys-locale",
diff --git a/desktop/README.md b/desktop/README.md
index 5e051fc61..0d5e3635d 100644
--- a/desktop/README.md
+++ b/desktop/README.md
@@ -221,6 +221,24 @@ the tray preserves the last shown frame, with off-screen recovery against the
current display work areas. Fullscreen, Spaces, visibility, and routes are not
restored. An absent or corrupt store uses the centered 1200×800 default.
+On macOS the main window uses an overlay title bar with a hidden title: the
+traffic lights float over the page and there is no separate title strip.
+WKWebView has no `app-region` CSS, and Tauri's drag-region attribute needs an IPC
+grant the Workbench origin must not have, so the shell lays one transparent
+native view (`src/macos_title_bar.rs`) over the top 28pt, above the WebView. A
+drag there moves the window; a double-click follows the system "double-click a
+window's title bar" setting. No capability or command is added. The shell also
+sets `--shell-titlebar-inset: 28px` on the top-level document before any page
+script runs; `ui/src/index.css` defaults it to `0px`, and Workbench surfaces
+that reach the top edge add it so no control sits under the strip. Because the
+shell can adopt an already-running Runtime whose older Workbench predates this
+contract, the overlay is opt-in per page: after every main-window page load the
+shell natively asks whether the page declares
+`<meta name="avibe-shell-titlebar-inset">` (both `index.html` files do). A page
+that does not, or cannot answer, gets the standard title bar with the window
+title, the strip hidden, and the inset reset to `0px`. Windows and Linux keep
+the native title bar and a zero inset.
+
For manual acceptance, use a packaged test install with isolated app config and
a fake loopback Runtime: set a non-default frame, quit/relaunch, hide/Open, and
deliver a link both before and after readiness. Check the destination and frame,
diff --git a/desktop/index.html b/desktop/index.html
index 323eb29db..867ee3912 100644
--- a/desktop/index.html
+++ b/desktop/index.html
@@ -4,6 +4,10 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Avibe</title>
+ <!-- Tells the macOS desktop shell this page lays itself out below its overlay
+ title bar (--shell-titlebar-inset); without it the shell keeps the standard
+ title bar. -->
+ <meta name="avibe-shell-titlebar-inset" content="supported" />
</head>
<body>
<main class="stage" role="main">
diff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.toml
index 3fbfa43e6..0a22b0a52 100644
--- a/desktop/src-tauri/Cargo.toml
+++ b/desktop/src-tauri/Cargo.toml
@@ -39,8 +39,24 @@ url.workspace = true
async-trait.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
+block2 = "0.6.2"
objc2 = "0.6.4"
objc2-foundation = { version = "0.3.2", default-features = false, features = [
"NSAppleEventDescriptor",
"NSAppleEventManager",
+ "NSArray",
+ "NSEnumerator",
+ "NSError",
+ "NSGeometry",
+ "NSString",
+ "NSUserDefaults",
] }
+objc2-app-kit = { version = "0.3.2", default-features = false, features = [
+ "std",
+ "NSEvent",
+ "NSGraphics",
+ "NSResponder",
+ "NSView",
+ "NSWindow",
+] }
+objc2-web-kit = { version = "0.3.2", default-features = false, features = ["std", "block2", "objc2-app-kit", "WKWebView"] }
diff --git a/desktop/src-tauri/src/lib.rs b/desktop/src-tauri/src/lib.rs
index b1a809950..57b3da6ea 100644
--- a/desktop/src-tauri/src/lib.rs
+++ b/desktop/src-tauri/src/lib.rs
@@ -23,6 +23,8 @@ mod notifications;
#[cfg(target_os = "macos")]
mod macos_deep_link;
+#[cfg(target_os = "macos")]
+mod macos_title_bar;
use avibe_runtime_host::deep_link::{DeepLinkNavigation, DeepLinks};
#[cfg(not(feature = "bundled-runtime"))]
@@ -1186,12 +1188,17 @@ fn ensure_main_window(app: &AppHandle) -> Option<WebviewWindow> {
.iter()
.find(|config| config.label == MAIN_WINDOW)?
.clone();
- WebviewWindowBuilder::from_config(app, &config)
+ let builder = WebviewWindowBuilder::from_config(app, &config)
.ok()?
.initialization_script(DESKTOP_SHELL_MARKER)
- .on_new_window(|url, _features| handle_new_window_request(url))
- .build()
- .ok()
+ .on_new_window(|url, _features| handle_new_window_request(url));
+ // macOS draws the page under an overlay title bar (`tauri.conf.json`).
+ #[cfg(target_os = "macos")]
+ let builder = builder.initialization_script(macos_title_bar::inset_script());
+ let window = builder.build().ok()?;
+ #[cfg(target_os = "macos")]
+ macos_title_bar::install(&window);
+ Some(window)
}
/// Tells the Workbench, before any of its scripts run, that it is rendered by
@@ -1603,6 +1610,10 @@ pub fn run() {
PluginBuilder::<_, ()>::new("shell-run-events")
.on_page_load(|webview, payload| {
if webview.label() == MAIN_WINDOW && payload.event() == tauri::webview::PageLoadEvent::Finished {
+ // Each loaded page decides whether it sits under the overlay
+ // title bar; an older adopted Workbench gets the standard one.
+ #[cfg(target_os = "macos")]
+ macos_title_bar::sync(webview);
apply_pending_deep_link(webview.app_handle());
// Settings become available the moment a Workbench is on
// screen, not at the monitor's first tick. The shared
diff --git a/desktop/src-tauri/src/macos_title_bar.rs b/desktop/src-tauri/src/macos_title_bar.rs
new file mode 100644
index 000000000..52c7611aa
--- /dev/null
+++ b/desktop/src-tauri/src/macos_title_bar.rs
@@ -0,0 +1,225 @@
+//! The macOS window draws the Workbench under its title bar.
+//!
+//! `tauri.conf.json` gives the main window an overlay title bar with a hidden
+//! title, so the traffic lights float over the page instead of sitting on a
+//! separate grey strip. Two things then have to hold:
+//!
+//! - The page must keep its own controls out of the strip. It learns the
+//! strip's height from `--shell-titlebar-inset`, which [`inset_script`] sets on
+//! the root element before any Workbench script runs.
+//! - The strip must still move the window. WKWebView honours no `app-region`
+//! CSS and swallows the mouse-down that would start a native drag, and Tauri's
+//! drag-region attribute needs an IPC grant the remote Workbench origin
+//! deliberately does not have. So the shell lays one transparent native view
+//! over the strip, above the WebView: a drag there moves the window and a
+//! double-click does what the system title bar would, with no page script
+//! involved and no capability widened.
+//!
+//! Both only hold for a page that knows the inset. The shell can adopt a
+//! Runtime it did not ship, whose older Workbench still puts controls in the top
+//! 28 points, so every loaded page is asked, natively and without IPC, whether
+//! it declares [`SUPPORT_META`]. A page that does keeps the overlay; any other
+//! page, or a page that cannot answer, gets the standard title bar back with the
+//! strip hidden and the inset reset to zero.
+
+use block2::RcBlock;
+use objc2::rc::Retained;
+use objc2::runtime::AnyObject;
+use objc2::{define_class, msg_send, ClassType, MainThreadMarker, MainThreadOnly};
+use objc2_app_kit::{
+ NSAutoresizingMaskOptions, NSEvent, NSResponder, NSView, NSWindow, NSWindowOrderingMode, NSWindowStyleMask,
+ NSWindowTitleVisibility,
+};
+use objc2_foundation::{
+ ns_string, NSError, NSObject, NSObjectProtocol, NSPoint, NSRect, NSSize, NSString, NSUserDefaults,
+};
+use objc2_web_kit::WKWebView;
+use tauri::{Webview, WebviewWindow};
+
+/// Height, in points, of the strip the overlay title bar occupies: the standard
+/// macOS title bar of a window without a toolbar, where the traffic lights sit.
+pub const TITLE_BAR_INSET: f64 = 28.0;
+
+/// Publishes [`TITLE_BAR_INSET`] to the Workbench and the bootstrap page. User
+/// scripts run after the document element exists and before any page script.
+/// Top-level document only: Show Page content in subframes is laid out by the
+/// Workbench window that hosts it.
+pub fn inset_script() -> String {
+ format!(
+ "if (window.self === window.top) \
+ document.documentElement.style.setProperty('--shell-titlebar-inset', '{TITLE_BAR_INSET}px');"
+ )
+}
+
+/// The `<meta name>` a page carries when it lays itself out below the strip.
+/// The Workbench (`ui/index.html`) and the bootstrap page (`index.html`) both
+/// declare it; a Workbench from before the overlay title bar does not.
+const SUPPORT_META: &str = "avibe-shell-titlebar-inset";
+
+/// Answers whether the loaded top-level page declares [`SUPPORT_META`], and
+/// makes the published inset agree with that answer.
+fn support_probe() -> String {
+ format!(
+ "(function () {{ \
+ var supported = document.querySelector('meta[name=\"{SUPPORT_META}\"]') !== null; \
+ document.documentElement.style.setProperty('--shell-titlebar-inset', supported ? '{TITLE_BAR_INSET}px' : '0px'); \
+ return supported ? 'supported' : 'unsupported'; }})()"
+ )
+}
+
+define_class!(
+ #[unsafe(super(NSView, NSResponder, NSObject))]
+ #[thread_kind = MainThreadOnly]
+ #[name = "AvibeTitleBarDragStrip"]
+ struct TitleBarDragStrip;
+
+ unsafe impl NSObjectProtocol for TitleBarDragStrip {}
+
+ impl TitleBarDragStrip {
+ #[unsafe(method(mouseDown:))]
+ fn mouse_down(&self, event: &NSEvent) {
+ let Some(window) = self.window() else {
+ return;
+ };
+ if event.clickCount() == 2 {
+ perform_title_bar_double_click(&window);
+ } else {
+ window.performWindowDragWithEvent(event);
+ }
+ }
+
+ /// A click on an inactive window drags it at once, as the system title
+ /// bar does, instead of being spent on activation.
+ #[unsafe(method(acceptsFirstMouse:))]
+ fn accepts_first_mouse(&self, _event: Option<&NSEvent>) -> bool {
+ true
+ }
+ }
+);
+
+impl TitleBarDragStrip {
+ fn new(mtm: MainThreadMarker, frame: NSRect) -> Retained<Self> {
+ let this = Self::alloc(mtm).set_ivars(());
+ unsafe { msg_send![super(this), initWithFrame: frame] }
+ }
+}
+
+/// The user's System Settings choice for double-clicking a title bar
+/// (Desktop & Dock > "Double-click a window's title bar to"). An unset value is
+/// the system default, zoom.
+fn perform_title_bar_double_click(window: &NSWindow) {
+ let action = NSUserDefaults::standardUserDefaults().stringForKey(ns_string!("AppleActionOnDoubleClick"));
+ match action.map(|action| action.to_string()).as_deref() {
+ Some("Minimize") => window.performMiniaturize(None),
+ Some("None") => {}
+ _ => window.performZoom(None),
+ }
+}
+
+/// Lays the drag strip over the top of the window's content, above the WebView.
+/// The window's content view holds the WebView for the window's whole life, and
+/// navigation replaces only the page inside it, so one strip per window suffices.
+pub fn install(window: &WebviewWindow) {
+ let _ = window.with_webview(|webview| {
+ let Some(mtm) = MainThreadMarker::new() else {
+ return;
+ };
+ // SAFETY: Tauri hands out the live NSWindow of this webview's window, on
+ // the main thread, for the duration of this closure.
+ let window: &NSWindow = unsafe { &*webview.ns_window().cast() };
+ let Some(content) = window.contentView() else {
+ return;
+ };
+ let bounds = content.bounds();
+ let flipped = content.isFlipped();
+ let y = if flipped {
+ 0.0
+ } else {
+ bounds.size.height - TITLE_BAR_INSET
+ };
+ let strip = TitleBarDragStrip::new(
+ mtm,
+ NSRect::new(NSPoint::new(0.0, y), NSSize::new(bounds.size.width, TITLE_BAR_INSET)),
+ );
+ // Pinned to the top edge and stretched with the width on every resize.
+ let pin_top = if flipped {
+ NSAutoresizingMaskOptions::ViewMaxYMargin
+ } else {
+ NSAutoresizingMaskOptions::ViewMinYMargin
+ };
+ strip.setAutoresizingMask(NSAutoresizingMaskOptions::ViewWidthSizable | pin_top);
+ content.addSubview_positioned_relativeTo(&strip, NSWindowOrderingMode::Above, None);
+ });
+}
+
+/// Keeps the overlay title bar only while the loaded page declares
+/// [`SUPPORT_META`]. Called for every finished main-window page load; a later
+/// load re-decides, so a stale answer never outlives the page that gave it.
+pub fn sync(webview: &Webview) {
+ let _ = webview.with_webview(|platform| {
+ let Some(mtm) = MainThreadMarker::new() else {
+ return;
+ };
+ // SAFETY: Tauri hands out the live WKWebView and its NSWindow, on the
+ // main thread, for the duration of this closure; retaining them keeps
+ // both alive until the completion handler has run.
+ let (Some(web_view), Some(window)) = (
+ unsafe { Retained::retain(platform.inner().cast::<WKWebView>()) },
+ unsafe { Retained::retain(platform.ns_window().cast::<NSWindow>()) },
+ ) else {
+ return;
+ };
+ let handler = RcBlock::new(move |result: *mut AnyObject, _error: *mut NSError| {
+ // SAFETY: WebKit passes the script's result, or null, as a live object.
+ let supported = unsafe { result.as_ref() }
+ .and_then(|result| result.downcast_ref::<NSString>())
+ .is_some_and(|answer| answer.to_string() == "supported");
+ set_overlay(&window, supported, mtm);
+ });
+ // SAFETY: called on the main thread with a live WKWebView; WebKit calls
+ // the handler once, on the main thread.
+ unsafe { web_view.evaluateJavaScript_completionHandler(&NSString::from_str(&support_probe()), Some(&handler)) };
+ });
+}
+
+/// Switches between the overlay title bar with the drag strip and the standard
+/// title bar with the window title, the only two frames the shell draws.
+fn set_overlay(window: &NSWindow, overlay: bool, _mtm: MainThreadMarker) {
+ let mut mask = window.styleMask();
+ mask.set(NSWindowStyleMask::FullSizeContentView, overlay);
+ window.setStyleMask(mask);
+ window.setTitlebarAppearsTransparent(overlay);
+ window.setTitleVisibility(if overlay {
+ NSWindowTitleVisibility::Hidden
+ } else {
+ NSWindowTitleVisibility::Visible
+ });
+ let Some(content) = window.contentView() else {
+ return;
+ };
+ for view in content.subviews().iter() {
+ if view.isKindOfClass(TitleBarDragStrip::class()) {
+ view.setHidden(!overlay);
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// A page that lays itself out below the strip must say so, or the shell
+ /// falls back to the standard title bar for it. Both pages the shell can
+ /// show at the current release declare the name the shell asks for.
+ #[test]
+ fn every_page_this_release_serves_declares_overlay_support() {
+ let crate_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
+ for page in ["../index.html", "../../ui/index.html"] {
+ let html = std::fs::read_to_string(crate_dir.join(page)).expect("page is readable");
+ assert!(
+ html.contains(&format!("<meta name=\"{SUPPORT_META}\"")),
+ "{page} must declare {SUPPORT_META}"
+ );
+ }
+ }
+}
diff --git a/desktop/src-tauri/tauri.conf.json b/desktop/src-tauri/tauri.conf.json
index f71bd0c0e..fff5f552d 100644
--- a/desktop/src-tauri/tauri.conf.json
+++ b/desktop/src-tauri/tauri.conf.json
@@ -21,7 +21,9 @@
"minHeight": 600,
"visible": false,
"center": true,
- "resizable": true
+ "resizable": true,
+ "titleBarStyle": "Overlay",
+ "hiddenTitle": true
}
],
"security": {
diff --git a/desktop/src-tauri/tests/shell_boundaries.rs b/desktop/src-tauri/tests/shell_boundaries.rs
index 06c8a9254..cd1e0157e 100644
--- a/desktop/src-tauri/tests/shell_boundaries.rs
+++ b/desktop/src-tauri/tests/shell_boundaries.rs
@@ -663,6 +663,20 @@ fn the_workbench_learns_it_runs_in_the_shell_from_one_top_level_marker() {
);
}
+#[test]
+fn the_macos_overlay_title_bar_needs_no_page_permission_and_defaults_to_no_inset() {
+ let window = &config()["app"]["windows"][0];
+ assert_eq!(window["titleBarStyle"], "Overlay");
+ assert_eq!(window["hiddenTitle"], true);
+ // The strip drags natively; the page is granted no window permission for it.
+ assert!(!read_to_string(&crate_dir().join("capabilities/bootstrap.json")).contains("start-dragging"));
+ let css = read_to_string(&crate_dir().join("../../ui/src/index.css"));
+ assert!(
+ css.contains("--shell-titlebar-inset: 0px;"),
+ "outside the macOS shell the Workbench must lay out with no title bar inset"
+ );
+}
+
#[test]
fn native_navigation_failures_return_to_a_retryable_bootstrap_state() {
let source = shipping_source("src/lib.rs");
diff --git a/docs/plans/desktop-test-release-20260922.md b/docs/plans/desktop-test-release-20260922.md
index 073ce26c5..14c9fb5e6 100644
--- a/docs/plans/desktop-test-release-20260922.md
+++ b/docs/plans/desktop-test-release-20260922.md
@@ -1222,6 +1222,13 @@ lane will not change that boundary on its own authority. Shipping the overlay
without a drag region would leave an undraggable window, so the item was dropped
from this head, as the owner allowed.
+*Follow-up (feat/desktop-overlay-titlebar):* the overlay ships without touching
+the capability boundary. The drag path is native instead of IPC: a transparent
+`NSView` over the top 28pt, above the WebView, calls
+`performWindowDragWithEvent`, and the shell publishes the strip height to the
+page as `--shell-titlebar-inset`. See `desktop/README.md`, "Native links and
+window frame".
+
## H22 — orchestrator hold on `f654f245b`
Two more boundaries in F1's class, one Settings gap, and the title-bar ruling.
diff --git a/ui/index.html b/ui/index.html
index f3c7dfc90..478ba4472 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -11,6 +11,10 @@
home + visualViewport --app-vvh chat, see useViewportHeightVar). -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Avibe</title>
+ <!-- Tells the macOS desktop shell this page lays itself out below its overlay
+ title bar (--shell-titlebar-inset); without it the shell keeps the standard
+ title bar. -->
+ <meta name="avibe-shell-titlebar-inset" content="supported" />
<!-- PWA / iOS standalone: "Add to Home Screen" launches a full-screen app
(no Safari chrome), which sidesteps the iOS keyboard whitespace/accessory
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index fced69d31..c0bd281ed 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -148,7 +148,7 @@ const ConfigRecoveryNotice: React.FC<{ config: ConfigRecoveryProjection | null }
if (!config?.config_recovery?.required) return null;
return (
- <div className="fixed inset-x-2 top-2 z-[70] mx-auto flex max-w-3xl items-start gap-3 rounded-lg border border-gold/45 bg-surface px-3 py-2.5 shadow-xl" role="alert">
+ <div className="fixed inset-x-2 top-[calc(0.5rem+var(--shell-titlebar-inset))] z-[70] mx-auto flex max-w-3xl items-start gap-3 rounded-lg border border-gold/45 bg-surface px-3 py-2.5 shadow-xl" role="alert">
<AlertTriangle className="mt-0.5 size-4 shrink-0 text-gold-ink" />
<div className="min-w-0 flex-1">
<p className="text-[13px] font-semibold text-foreground">{t('configRecovery.title')}</p>
@@ -464,7 +464,7 @@ export const AppShell: React.FC = () => {
aria-hidden={settingsCoversSidebar || undefined}
inert={settingsCoversSidebar || undefined}
className={clsx(
- 'fixed inset-y-0 left-0 z-10 hidden w-[var(--app-sidebar-w)] flex-col justify-between gap-6 border-r border-border bg-[var(--sidebar-background)] px-4 pt-2.5 pb-4 md:flex',
+ 'fixed inset-y-0 left-0 z-10 hidden w-[var(--app-sidebar-w)] flex-col justify-between gap-6 border-r border-border bg-[var(--sidebar-background)] px-4 pt-[calc(0.625rem+var(--shell-titlebar-inset))] pb-4 md:flex',
settingsCoversSidebar && 'invisible pointer-events-none',
)}
>
diff --git a/ui/src/components/apps/WindowLayer.tsx b/ui/src/components/apps/WindowLayer.tsx
index 632f1536c..65dffc58d 100644
--- a/ui/src/components/apps/WindowLayer.tsx
+++ b/ui/src/components/apps/WindowLayer.tsx
@@ -296,7 +296,7 @@ export const WindowLayer: React.FC<{ active?: boolean }> = ({ active = true }) =
// Spans the FULL viewport (no longer offset past the sidebar): windows can move over
// the sidebar and maximize fills the whole screen. This layer (z-20) sits ABOVE the sidebar
// (z-10), but below the portaled Apps launcher and Dock (z-30).
- className="pointer-events-none fixed inset-0 z-20 hidden md:block"
+ className="pointer-events-none fixed inset-x-0 bottom-0 top-[var(--shell-titlebar-inset)] z-20 hidden md:block"
>
{windows.map((w) => {
// For a showpage window, join the inventory (already loaded above — no new
diff --git a/ui/src/components/onboarding/onboarding.css b/ui/src/components/onboarding/onboarding.css
index 7d3de626f..f41d19e5f 100644
--- a/ui/src/components/onboarding/onboarding.css
+++ b/ui/src/components/onboarding/onboarding.css
@@ -160,7 +160,8 @@
overflow-y: auto;
display: flex;
flex-direction: column;
- padding: 0;
+ /* Clears the desktop shell's overlay title bar (0 elsewhere). */
+ padding: var(--shell-titlebar-inset) 0 0;
}
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) .onboarding-shell { --ob-theme: light; }
diff --git a/ui/src/components/settings/SettingsLayout.tsx b/ui/src/components/settings/SettingsLayout.tsx
index 34b1885c2..8b5073f30 100644
--- a/ui/src/components/settings/SettingsLayout.tsx
+++ b/ui/src/components/settings/SettingsLayout.tsx
@@ -429,7 +429,7 @@ export const SettingsLayout: React.FC = () => {
<nav
aria-label={t('settings.navigationLabel')}
className={clsx(
- 'min-h-0 shrink-0 border-r border-border bg-surface/70 px-2 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3',
+ 'min-h-0 shrink-0 border-r border-border bg-surface/70 px-2 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3 md:pt-[calc(0.75rem+var(--shell-titlebar-inset))]',
'w-full flex-col',
standaloneMenu ? 'md:w-[var(--app-sidebar-w)]' : 'md:w-[196px]',
atRoot ? 'flex' : 'hidden md:flex',
@@ -469,7 +469,9 @@ export const SettingsLayout: React.FC = () => {
</div>
</nav>
- <section className={clsx('min-w-0 flex-1 overflow-y-auto', atRoot && 'hidden md:block')}>
+ {/* Under the macOS overlay title bar the header above is gone, so the
+ rail and the page start below the strip the traffic lights sit in. */}
+ <section className={clsx('min-w-0 flex-1 overflow-y-auto md:mt-[var(--shell-titlebar-inset)]', atRoot && 'hidden md:block')}>
<div
key={location.pathname}
className={clsx(
diff --git a/ui/src/components/settings/models/menus/MenuDrawer.tsx b/ui/src/components/settings/models/menus/MenuDrawer.tsx
index 80db51ffe..15f1d91c8 100644
--- a/ui/src/components/settings/models/menus/MenuDrawer.tsx
+++ b/ui/src/components/settings/models/menus/MenuDrawer.tsx
@@ -72,7 +72,7 @@ export const MenuDrawer: React.FC<{
<header
className={cn(
'flex items-start gap-3 border-b border-border px-4 py-4 sm:px-6 sm:py-5',
- !isMobile && 'pt-[calc(1rem+env(safe-area-inset-top))] sm:pt-5',
+ !isMobile && 'pt-[calc(1rem+env(safe-area-inset-top))] sm:pt-[calc(1.25rem+var(--shell-titlebar-inset))]',
)}
>
<span className={cn('flex size-10 shrink-0 items-center justify-center rounded-[12px] sm:size-11', ACCENT_TILE[accent])}>
diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.css
index eb5fc5ef7..b3297b5c1 100644
--- a/ui/src/components/settings/models/modelHubSurface.css
+++ b/ui/src/components/settings/models/modelHubSurface.css
@@ -1841,6 +1841,8 @@
--model-hub-order-width: 460px;
width: min(var(--model-hub-order-width), 100vw);
border-left: 1px solid var(--border-strong);
+ /* Clears the desktop shell's overlay title bar (0 elsewhere). */
+ padding-top: var(--shell-titlebar-inset);
box-shadow: var(--model-hub-drawer-shadow);
}
diff --git a/ui/src/components/ui/image-viewer.tsx b/ui/src/components/ui/image-viewer.tsx
index 2dca26dcb..de4b7b661 100644
--- a/ui/src/components/ui/image-viewer.tsx
+++ b/ui/src/components/ui/image-viewer.tsx
@@ -147,7 +147,7 @@ export const ImageViewerProvider: React.FC<{ images: string[]; children: React.R
role="dialog"
aria-modal="true"
>
- <div className="absolute right-4 top-4 z-10 flex items-center gap-2">
+ <div className="absolute right-4 top-[calc(1rem+var(--shell-titlebar-inset))] z-10 flex items-center gap-2">
{/* Zoom buttons: a pointer-device affordance (touch zooms by pinch).
stopPropagation so clicking a control doesn't also close the viewer. */}
<Button
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index 232f707f6..fe708a181 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -3669,7 +3669,7 @@ export const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, d
// hairline bottom border separating it from the scrolling transcript.
// No project-id pill and no override banner — both were noise the user
// flagged (regression feedback #1/#3).
- <div className="shrink-0 border-b border-border bg-surface/70 px-4 py-2.5 backdrop-blur md:px-8">
+ <div className="shrink-0 border-b border-border bg-surface/70 px-4 py-2.5 backdrop-blur md:px-8 md:pt-[max(0.625rem,var(--shell-titlebar-inset))]">
<div className="mx-auto flex w-full max-w-[1080px] items-center gap-3">
<Button
type="button"
diff --git a/ui/src/components/workbench/SearchPage.tsx b/ui/src/components/workbench/SearchPage.tsx
index 23eea5854..d3dbbcb8e 100644
--- a/ui/src/components/workbench/SearchPage.tsx
+++ b/ui/src/components/workbench/SearchPage.tsx
@@ -102,7 +102,7 @@ export const SearchPage: React.FC = () => {
// routes here (sidebar field + ⌘K own search), but keep it sane if hit.
<div className="fixed inset-0 z-40 flex flex-col bg-background pt-[env(safe-area-inset-top)] md:absolute">
{/* Header — back chevron + active search field (design.pen P6Nsz/KmsNV). */}
- <header className="flex shrink-0 items-center gap-2.5 border-b border-border bg-background/92 px-4 py-3 backdrop-blur">
+ <header className="flex shrink-0 items-center gap-2.5 border-b border-border bg-background/92 px-4 py-3 backdrop-blur md:pt-[max(0.75rem,var(--shell-titlebar-inset))]">
<Button
type="button"
variant="ghost"
diff --git a/ui/src/index.css b/ui/src/index.css
index db735e512..af70dbdb4 100644
--- a/ui/src/index.css
+++ b/ui/src/index.css
@@ -35,6 +35,17 @@
--mobile-nav-clearance: calc(5.5rem + env(safe-area-inset-bottom));
}
+/* Height of the desktop shell's overlay title bar. On macOS the shell draws the
+ page under its title bar, with the window controls floating over the top
+ strip and a native drag area laid over it that no page control can receive
+ clicks through. The shell's init script sets the real height on the document
+ element before any page script runs; everywhere else — browsers, the PWA,
+ other desktop platforms — it stays 0. Every surface anchored to the top of the
+ viewport pads its own top by this, so nothing interactive sits in the strip. */
+:root {
+ --shell-titlebar-inset: 0px;
+}
+
/* Width of the desktop shell sidebar. The sidebar itself, every md+ content
offset and the Settings overlay's left edge read this one value, so dragging
the divider moves all of them together — including the overlay, which lives in