Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Align desktop titlebar controls by platform (#7837)

Wasim Yousef Said640f8586c78e
diff --git a/studio/backend/core/data_recipe/oxc-validator/package-lock.json b/studio/backend/core/data_recipe/oxc-validator/package-lock.json
index 1e630cfd7e9..7a6c22547c0 100644
--- a/studio/backend/core/data_recipe/oxc-validator/package-lock.json
+++ b/studio/backend/core/data_recipe/oxc-validator/package-lock.json
@@ -13,32 +13,35 @@
}
},
"node_modules/@emnapi/core": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
- "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz",
+ "integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
- "@emnapi/wasi-threads": "1.2.1",
+ "@emnapi/wasi-threads": "1.2.3",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
- "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
+ "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
- "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
+ "integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
@@ -335,6 +338,37 @@
"node": "^20.19.0 || >=22.12.0"
}
},
+ "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@emnapi/core": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
+ "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/wasi-threads": "1.2.1",
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@emnapi/runtime": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
+ "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
+ "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
"node_modules/@oxc-parser/binding-win32-arm64-msvc": {
"version": "0.131.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.131.0.tgz",
diff --git a/studio/frontend/package-lock.json b/studio/frontend/package-lock.json
index 4f0aedea739..ea33b4560cc 100644
--- a/studio/frontend/package-lock.json
+++ b/studio/frontend/package-lock.json
@@ -1055,32 +1055,35 @@
}
},
"node_modules/@emnapi/core": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
- "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz",
+ "integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
- "@emnapi/wasi-threads": "1.2.1",
+ "@emnapi/wasi-threads": "1.2.3",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
- "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
+ "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
- "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
+ "integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
@@ -5792,6 +5795,37 @@
"node": "^20.19.0 || >=22.12.0"
}
},
+ "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/core": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
+ "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/wasi-threads": "1.2.1",
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/runtime": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
+ "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
+ "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
"node_modules/@rolldown/binding-win32-arm64-msvc": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.3.tgz",
diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx
index 673fec505c1..f7385faab82 100644
--- a/studio/frontend/src/app/provider.tsx
+++ b/studio/frontend/src/app/provider.tsx
@@ -280,7 +280,10 @@ const WEB_UPDATE_HIDDEN_ROUTES = new Set([
const MAC_NATIVE_CHROME_STYLE = {
"--studio-titlebar-height": "0px",
"--studio-mac-titlebar-height": "34px",
+ "--studio-desktop-titlebar-height": "34px",
+ "--studio-titlebar-navigation-offset-y": "2px",
"--studio-mac-traffic-light-inset": "78px",
+ "--studio-collapsed-chat-controls-inset": "188px",
"--studio-startup-top-inset": "58px",
"--studio-content-top-inset": "0px",
"--studio-non-chat-content-top-inset": "34px",
@@ -294,8 +297,10 @@ const MAC_NATIVE_CHROME_STYLE = {
const CUSTOM_CHROME_STYLE = {
"--studio-titlebar-height": "0px",
"--studio-custom-titlebar-height": "34px",
+ "--studio-desktop-titlebar-height": "34px",
"--studio-sidebar-expanded-width": "17.5rem",
"--studio-sidebar-collapsed-width": "3rem",
+ "--studio-collapsed-chat-controls-inset": "12px",
"--studio-startup-top-inset": "42px",
"--studio-content-top-inset": "34px",
"--studio-hidden-route-top-inset": "34px",
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index c925b4e2b6c..f1bb76cca9f 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -45,6 +45,7 @@ import { Spinner } from "@/components/ui/spinner";
import { Switch } from "@/components/ui/switch";
import { useAnimatedThemeToggle } from "@/components/ui/animated-theme-toggler";
import {
+ DesktopTitlebarNavigation,
getClientPlatform,
shouldUseCustomWindowTitlebar,
shouldUseNativeMacWindowTitlebar,
@@ -361,7 +362,7 @@ function NavItem({
data-tour={dataTour}
className="sidebar-nav-btn h-[33px] rounded-full gap-[8.5px] pl-3 pr-2.5 font-medium group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:!w-[32px] group-data-[collapsible=icon]:mx-auto"
>
- <HugeiconsIcon icon={icon} strokeWidth={1.75} className="size-icon! shrink-0 group-hover/menu-button:animate-icon-pop" />
+ <HugeiconsIcon icon={icon} strokeWidth={1.75} className="size-icon! shrink-0 translate-x-0.5 group-hover/menu-button:animate-icon-pop" />
<span className="text-ui-14p5 leading-ui-19 tracking-nav">{label}</span>
{badge && (
<NavBadge
@@ -552,6 +553,7 @@ export function AppSidebar() {
}),
});
const {
+ pinned,
togglePinned,
isMobile,
setOpenMobile,
@@ -840,6 +842,8 @@ export function AppSidebar() {
]);
const chatDisabled = trainingInProgress;
+ const usesDesktopTitlebar = usesCustomTitlebar || usesNativeMacTitlebar;
+
// One definition per row, so pinned rows and the flyout can't drift apart.
const navRows: Record<SidebarNavItemId, NavRowDef> = {
@@ -999,8 +1003,7 @@ export function AppSidebar() {
sidebarState !== "collapsed" &&
!(navRows.images.active && imagesPageMode === "train");
- const showSidebarBrand = !usesCustomTitlebar;
- const showCompactMacBrand = showSidebarBrand && usesNativeMacTitlebar;
+ const showSidebarBrand = true;
function chatSearchForProject(projectId: string | null) {
if (projectId) {
@@ -1577,6 +1580,7 @@ export function AppSidebar() {
<>
<Sidebar
collapsible="icon"
+ collapseToZero={isTauri}
variant="sidebar"
className={cn(
// Rail background comes from --sidebar-surface (index.css) so the
@@ -1589,32 +1593,33 @@ export function AppSidebar() {
<SidebarHeader
className={cn(
"relative",
- showSidebarBrand
- ? showCompactMacBrand
- ? "h-[var(--studio-chat-header-height,48px)] pl-[calc(var(--studio-mac-traffic-light-inset,78px)+6px)] pr-2 pt-[var(--studio-chat-header-padding-top,9px)] pb-0 group-data-[collapsible=icon]:h-[calc(var(--studio-mac-titlebar-height,34px)+var(--studio-chat-control-height,33px)+8px)] group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:pt-[calc(var(--studio-mac-titlebar-height,34px)+8px)]"
- : "pl-[17px] pr-3 pt-[14px] pb-[8px] group-data-[collapsible=icon]:px-0"
- : "h-[var(--studio-custom-titlebar-height,34px)] shrink-0 p-0",
+ usesDesktopTitlebar
+ ? "shrink-0 p-0 pt-[calc(var(--studio-desktop-titlebar-height,34px)+6px)]"
+ : "pl-3 pr-3 pt-[14px] pb-[8px] group-data-[collapsible=icon]:px-0",
)}
>
{showSidebarBrand && (
<>
- {usesNativeMacTitlebar && (
+ {usesNativeMacTitlebar && !isMobile && (
<div
data-tauri-drag-region
- aria-hidden="true"
- className="absolute inset-x-0 top-0 z-0 h-[var(--studio-mac-titlebar-height,34px)] select-none"
- />
+ className="absolute inset-x-0 top-0 z-10 flex h-[var(--studio-desktop-titlebar-height,34px)] items-start pt-px pl-[calc(var(--studio-mac-traffic-light-inset,78px)+6px)] select-none group-data-[collapsible=icon]:hidden"
+ >
+ <DesktopTitlebarNavigation
+ expanded={pinned}
+ onToggleSidebar={togglePinned}
+ />
+ </div>
)}
<div
data-tauri-drag-region={usesNativeMacTitlebar || undefined}
className={cn(
"relative z-10 flex items-center gap-[8.5px] group-data-[collapsible=icon]:hidden",
- showCompactMacBrand &&
- "h-[var(--studio-chat-control-height,33px)] justify-end gap-2",
- !showCompactMacBrand && "justify-between",
+ usesDesktopTitlebar
+ ? "justify-between pl-4 pr-3"
+ : "justify-between",
)}
>
- {!showCompactMacBrand && (
<Link
to="/chat"
onClick={(event) => {
@@ -1637,16 +1642,15 @@ export function AppSidebar() {
<img
src="/circle-logo-small.png"
alt="Unsloth"
- className="h-[calc(26px+0.5rem*var(--ui-font-scale,1))] w-[calc(26px+0.5rem*var(--ui-font-scale,1))] shrink-0 rounded-full object-cover"
+ className="h-[calc(22px+0.5rem*var(--ui-font-scale,1))] w-[calc(22px+0.5rem*var(--ui-font-scale,1))] shrink-0 rounded-full object-cover"
/>
- <span className="truncate font-heading text-[calc(13px+0.5rem*var(--ui-font-scale,1))] font-semibold tracking-[0em] leading-tight text-black dark:text-white dark:tracking-[0.02em]">
+ <span className="relative -top-px truncate font-heading text-[calc(13px+0.5rem*var(--ui-font-scale,1))] font-semibold tracking-[0em] leading-tight text-black dark:text-white dark:tracking-[0.02em]">
unsloth
</span>
<span className="nav-badge ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full border border-nav-beta-border px-[5px] pt-[3px] pb-[2px] text-[calc(0.5rem*var(--ui-font-scale,1))] font-medium leading-none tracking-[0.04em] text-nav-fg-muted antialiased subpixel-antialiased shadow-[0_1px_2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]">
{t("shell.beta")}
</span>
</Link>
- )}
<div className="flex shrink-0 items-center gap-0.25">
<Tooltip>
<TooltipPrimitive.Trigger asChild>
@@ -1674,7 +1678,7 @@ export function AppSidebar() {
</kbd>
</TooltipContent>
</Tooltip>
- {!isMobile && (
+ {!isMobile && !usesDesktopTitlebar && (
<Tooltip>
<TooltipPrimitive.Trigger asChild>
<button
@@ -1697,7 +1701,7 @@ export function AppSidebar() {
)}
</div>
</div>
- {!isMobile && (
+ {!isMobile && (!usesDesktopTitlebar || usesNativeMacTitlebar) && (
<div className="relative z-10 hidden group-data-[collapsible=icon]:flex h-[33px] items-center justify-center w-full">
<Tooltip>
<TooltipPrimitive.Trigger asChild>
@@ -1728,7 +1732,7 @@ export function AppSidebar() {
<SidebarGroup
className={cn(
"group-data-[collapsible=icon]:px-0 pl-1.5 pr-1.75 shrink-0 transition-[padding]",
- showCompactMacBrand ? "pt-0" : "pt-[9px]",
+ usesDesktopTitlebar ? "pt-3" : "pt-[9px]",
// Scrolled: New Chat is pinned, give a little gap below it.
scrolled ? "pb-[5px]" : "pb-px",
)}
diff --git a/studio/frontend/src/components/navbar.tsx b/studio/frontend/src/components/navbar.tsx
index 1165705888e..deb3755f388 100644
--- a/studio/frontend/src/components/navbar.tsx
+++ b/studio/frontend/src/components/navbar.tsx
@@ -1,24 +1,38 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { shouldUseNativeMacWindowTitlebar } from "@/components/tauri/window-titlebar";
+import {
+ DesktopTitlebarNavigation,
+ shouldUseNativeMacWindowTitlebar,
+} from "@/components/tauri/window-titlebar";
import { SidebarTrigger, useSidebar } from "@/components/ui/sidebar";
import { useState } from "react";
export function Navbar() {
- const { isMobile } = useSidebar();
+ const { isMobile, pinned, togglePinned } = useSidebar();
const [usesNativeMacTitlebar] = useState(shouldUseNativeMacWindowTitlebar);
+
if (!isMobile) {
return (
- <header className="absolute top-0 inset-x-0 z-40 h-[48px] pointer-events-none">
- {usesNativeMacTitlebar && (
- <div
- data-tauri-drag-region
- aria-hidden="true"
- className="pointer-events-auto absolute inset-x-0 top-0 h-[var(--studio-mac-titlebar-height,34px)] select-none"
+ <>
+ <header className="pointer-events-none absolute inset-x-0 top-0 z-40 h-[48px]">
+ {usesNativeMacTitlebar && (
+ <div
+ data-tauri-drag-region
+ aria-hidden="true"
+ className="pointer-events-auto absolute inset-x-0 top-0 h-[var(--studio-mac-titlebar-height,34px)] select-none"
+ />
+ )}
+ </header>
+
+ {usesNativeMacTitlebar && !pinned && (
+ <DesktopTitlebarNavigation
+ expanded={false}
+ onToggleSidebar={togglePinned}
+ className="pointer-events-auto absolute left-[calc(var(--studio-mac-traffic-light-inset,78px)+6px)] top-px z-[60]"
/>
)}
- </header>
+ </>
);
}
return (
diff --git a/studio/frontend/src/components/tauri/window-titlebar.tsx b/studio/frontend/src/components/tauri/window-titlebar.tsx
index 9ba13131545..989856ce94f 100644
--- a/studio/frontend/src/components/tauri/window-titlebar.tsx
+++ b/studio/frontend/src/components/tauri/window-titlebar.tsx
@@ -13,6 +13,7 @@ import {
SquareSquareIcon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
+import { ArrowLeft, ArrowRight } from "lucide-react";
import type { Window as TauriWindow } from "@tauri-apps/api/window";
import {
type MouseEvent,
@@ -20,6 +21,7 @@ import {
type ReactNode,
useCallback,
useEffect,
+ useRef,
useState,
} from "react";
@@ -103,6 +105,88 @@ function WindowControlButton({
);
}
+export function DesktopTitlebarNavigation({
+ expanded,
+ onToggleSidebar,
+ className,
+}: {
+ expanded: boolean;
+ onToggleSidebar: () => void;
+ className?: string;
+}): ReactElement {
+ const stopTitlebarDrag = (event: MouseEvent<HTMLButtonElement>) => {
+ event.stopPropagation();
+ };
+ const buttonClass =
+ "inline-flex size-[33px] shrink-0 items-center justify-center rounded-[10px] text-nav-icon-idle transition-colors hover:bg-nav-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";
+
+ return (
+ <div
+ className={cn(
+ "flex mt-1 translate-y-[var(--studio-titlebar-navigation-offset-y,0px)] items-center gap-0.5",
+ className,
+ )}
+ role="toolbar"
+ aria-label="Sidebar and page navigation"
+ >
+ <button
+ type="button"
+ title={expanded ? "Collapse sidebar" : "Expand sidebar"}
+ aria-label={expanded ? "Collapse sidebar" : "Expand sidebar"}
+ onMouseDown={stopTitlebarDrag}
+ onDoubleClick={stopTitlebarDrag}
+ onClick={(event) => {
+ event.stopPropagation();
+ onToggleSidebar();
+ }}
+ className={buttonClass}
+ >
+ <HugeiconsIcon
+ icon={LayoutAlignLeftIcon}
+ strokeWidth={1.75}
+ className="size-icon"
+ />
+ </button>
+ <button
+ type="button"
+ title="Go back"
+ aria-label="Go back"
+ onMouseDown={stopTitlebarDrag}
+ onDoubleClick={stopTitlebarDrag}
+ onClick={(event) => {
+ event.stopPropagation();
+ window.history.back();
+ }}
+ className={buttonClass}
+ >
+ <ArrowLeft
+ aria-hidden="true"
+ strokeWidth={1.75}
+ className="size-icon"
+ />
+ </button>
+ <button
+ type="button"
+ title="Go forward"
+ aria-label="Go forward"
+ onMouseDown={stopTitlebarDrag}
+ onDoubleClick={stopTitlebarDrag}
+ onClick={(event) => {
+ event.stopPropagation();
+ window.history.forward();
+ }}
+ className={buttonClass}
+ >
+ <ArrowRight
+ aria-hidden="true"
+ strokeWidth={1.75}
+ className="size-icon"
+ />
+ </button>
+ </div>
+ );
+}
+
export function WindowTitlebar({
showSidebarSurface = false,
}: {
@@ -111,6 +195,9 @@ export function WindowTitlebar({
const [enabled] = useState(shouldUseCustomWindowTitlebar);
const [maximized, setMaximized] = useState(false);
const { pinned, togglePinned } = useSidebarPin();
+
+ const maximizeRefreshSequence = useRef(0);
+ const maximizeRefreshTimer = useRef<number | null>(null);
// The titlebar sits outside the sidebar wrapper, so it cannot inherit
// --sidebar-width. Read the resized width from the same store instead.
const { width } = useSidebarWidth();
@@ -120,20 +207,37 @@ export function WindowTitlebar({
`var(--studio-sidebar-live-width, ${width}px)`
: "var(--studio-sidebar-collapsed-width,3rem)"
: "0px";
+
+ const titlebarNavigationWidth =
+ showSidebarSurface && !pinned ? "7rem" : sidebarWidth;
const contentBorderLeft = pinned ? `calc(${sidebarWidth} + 12px)` : "0px";
const refreshMaximized = useCallback(async () => {
if (!enabled) {
return;
}
+ const refreshSequence = ++maximizeRefreshSequence.current;
try {
const appWindow = await getAppWindow();
- setMaximized(await appWindow.isMaximized());
+ const nextMaximized = await appWindow.isMaximized();
+ if (refreshSequence === maximizeRefreshSequence.current) {
+ setMaximized(nextMaximized);
+ }
} catch {
// Window permission not ready yet: keep previous visual state.
}
}, [enabled]);
+ const scheduleMaximizedRefresh = useCallback(() => {
+ if (maximizeRefreshTimer.current !== null) {
+ window.clearTimeout(maximizeRefreshTimer.current);
+ }
+ maximizeRefreshTimer.current = window.setTimeout(() => {
+ maximizeRefreshTimer.current = null;
+ refreshMaximized().catch(() => undefined);
+ }, 80);
+ }, [refreshMaximized]);
+
useEffect(() => {
if (!enabled) {
return;
@@ -150,10 +254,10 @@ export function WindowTitlebar({
}
setMaximized(await appWindow.isMaximized());
unlistenResize = await appWindow.onResized(() => {
- refreshMaximized().catch(() => undefined);
+ scheduleMaximizedRefresh();
});
unlistenFocus = await appWindow.onFocusChanged(() => {
- refreshMaximized().catch(() => undefined);
+ scheduleMaximizedRefresh();
});
} catch {
// Missing capabilities should not break the rest of the app shell.
@@ -164,10 +268,16 @@ export function WindowTitlebar({
return () => {
mounted = false;
+
+ maximizeRefreshSequence.current += 1;
+ if (maximizeRefreshTimer.current !== null) {
+ window.clearTimeout(maximizeRefreshTimer.current);
+ maximizeRefreshTimer.current = null;
+ }
unlistenResize?.();
unlistenFocus?.();
};
- }, [enabled, refreshMaximized]);
+ }, [enabled, refreshMaximized, scheduleMaximizedRefresh]);
const runWindowAction = useCallback(
(action: (appWindow: TauriWindow) => Promise<void>) => {
@@ -175,7 +285,7 @@ export function WindowTitlebar({
try {
const appWindow = await getAppWindow();
await action(appWindow);
- await refreshMaximized();
+ scheduleMaximizedRefresh();
} catch {
// Keep custom chrome inert rather than throwing into React on denied commands.
}
@@ -183,7 +293,7 @@ export function WindowTitlebar({
runAction().catch(() => undefined);
},
- [refreshMaximized],
+ [scheduleMaximizedRefresh],
);
const handleDragMouseDown = useCallback(
@@ -262,74 +372,22 @@ export function WindowTitlebar({
<div
className={cn(
"pointer-events-auto absolute left-0 top-0 flex h-full min-w-0 items-center",
- pinned ? "gap-2 pl-3" : "justify-center",
+ "pl-3",
)}
- style={{ width: sidebarWidth }}
+ style={{ width: titlebarNavigationWidth }}
onMouseDown={handleDragMouseDown}
onDoubleClick={handleDragDoubleClick}
>
- {pinned ? (
- <>
- <div className="flex min-w-0 flex-1 items-center gap-2">
- <img
- src="/rounded-512.png"
- alt=""
- aria-hidden="true"
- draggable={false}
- className="size-5 shrink-0 rounded-[6px] object-cover"
- />
- <span className="min-w-0 truncate text-ui-13 font-semibold leading-none tracking-[0.01em] text-nav-fg">
- Unsloth
- </span>
- </div>
- <button
- type="button"
- title="Collapse sidebar"
- aria-label="Collapse sidebar"
- onMouseDown={(event) => event.stopPropagation()}
- onDoubleClick={(event) => event.stopPropagation()}
- onClick={(event) => {
- event.stopPropagation();
- togglePinned();
- }}
- className="inline-flex size-8 shrink-0 items-center justify-center rounded-[10px] text-nav-icon-idle transition-colors hover:bg-nav-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
- >
- <HugeiconsIcon
- icon={LayoutAlignLeftIcon}
- strokeWidth={1.75}
- className="size-icon"
- />
- </button>
- </>
- ) : (
- <button
- type="button"
- title="Expand sidebar"
- aria-label="Expand sidebar"
- onMouseDown={(event) => event.stopPropagation()}
- onDoubleClick={(event) => event.stopPropagation()}
- onClick={(event) => {
- event.stopPropagation();
- togglePinned();
- }}
- className="inline-flex size-8 items-center justify-center rounded-[10px] transition-colors hover:bg-nav-surface-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
- >
- <img
- src="/rounded-512.png"
- alt=""
- aria-hidden="true"
- draggable={false}
- className="size-5 rounded-[6px] object-cover"
- />
- <span className="sr-only">Expand sidebar</span>
- </button>
- )}
+ <DesktopTitlebarNavigation
+ expanded={pinned}
+ onToggleSidebar={togglePinned}
+ />
</div>
)}
<div
className="pointer-events-auto absolute top-0 h-full"
style={{
- left: sidebarWidth,
+ left: titlebarNavigationWidth,
right: "calc(var(--studio-window-control-inset,112px) + 0.5rem)",
}}
onMouseDown={handleDragMouseDown}
diff --git a/studio/frontend/src/components/ui/sidebar.tsx b/studio/frontend/src/components/ui/sidebar.tsx
index e26a55694fc..d5483e58846 100644
--- a/studio/frontend/src/components/ui/sidebar.tsx
+++ b/studio/frontend/src/components/ui/sidebar.tsx
@@ -220,6 +220,7 @@ function Sidebar({
side = "left",
variant = "sidebar",
collapsible = "offcanvas",
+ collapseToZero = false,
className,
children,
dir,
@@ -228,6 +229,7 @@ function Sidebar({
side?: "left" | "right"
variant?: "sidebar" | "floating" | "inset"
collapsible?: "offcanvas" | "icon" | "none"
+ collapseToZero?: boolean
}) {
const { isMobile, state, openMobile, setOpenMobile, hasPinMode, pinned } = useSidebar()
@@ -272,13 +274,15 @@ function Sidebar({
className={cn(
"group peer text-sidebar-foreground relative shrink-0",
hasPinMode && pinned && "w-(--sidebar-width)",
- hasPinMode && !pinned && "w-(--sidebar-width-icon)",
+ hasPinMode && !pinned && (collapseToZero ? "w-0" : "w-(--sidebar-width-icon)"),
)}
data-state={state}
data-collapsible={state === "collapsed" ? collapsible : ""}
data-variant={variant}
data-side={side}
data-slot="sidebar"
+ aria-hidden={(hasPinMode && !pinned && collapseToZero) || undefined}
+ inert={(hasPinMode && !pinned && collapseToZero) || undefined}
>
{/* This is what handles the sidebar gap on desktop */}
<div
@@ -291,9 +295,11 @@ function Sidebar({
// Pin mode: always push content. Expanded when pinned.
pinned
? "w-(--sidebar-width)"
- : (variant === "floating" || variant === "inset"
- ? "w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
- : "w-(--sidebar-width-icon)"),
+ : collapseToZero
+ ? "w-0"
+ : (variant === "floating" || variant === "inset"
+ ? "w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
+ : "w-(--sidebar-width-icon)"),
)
: cn(
// Legacy mode: original shadcn behavior.
@@ -312,8 +318,12 @@ function Sidebar({
hasPinMode
? cn(
// Pin mode: always push content, full height.
- "absolute top-0 bottom-0 flex w-(--sidebar-width) data-[side=left]:left-0",
- "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
+ "absolute top-0 bottom-0 flex data-[side=left]:left-0",
+ pinned
+ ? "w-(--sidebar-width)"
+ : collapseToZero
+ ? "w-0 overflow-hidden"
+ : "w-(--sidebar-width-icon)",
)
: cn(
// Legacy mode: fixed to viewport (original shadcn behavior).
@@ -337,7 +347,7 @@ function Sidebar({
>
{children}
</div>
- <SidebarResizeHandle side={side} />
+ {(!collapseToZero || pinned) && <SidebarResizeHandle side={side} />}
</div>
</div>
)
diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx
index 01f1bb06302..3c519937a88 100644
--- a/studio/frontend/src/features/chat/chat-page.tsx
+++ b/studio/frontend/src/features/chat/chat-page.tsx
@@ -88,6 +88,7 @@ import {
MoreVerticalIcon,
PinIcon,
PinOffIcon,
+ PencilEdit02Icon,
Telescope02Icon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
@@ -186,6 +187,7 @@ import { useExternalProvidersStore } from "./stores/external-providers-store";
import { syncExternalProvidersFromBackend } from "./sync-external-providers";
import { buildChatTourSteps } from "./tour";
import type { ChatView, MessageRecord } from "./types";
+import { clearNewChatDraft } from "./utils/composer-draft";
import {
getStoredChatThread,
isExpectedBackgroundChatStorageError,
@@ -198,7 +200,6 @@ import {
hasProjectSourcesPending,
} from "@/features/rag/components/project-source-dropzone";
-
const ProjectSourcesPanel = lazy(() =>
import("@/features/rag/components/project-sources-panel").then((module) => ({
default: module.ProjectSourcesPanel,
@@ -1951,6 +1952,20 @@ export function ChatPage({
},
[navigate],
);
+
+ const handleDesktopNewChat = useCallback(() => {
+ clearNewChatDraft();
+ const runtime = useChatRuntimeStore.getState();
+ runtime.setActiveThreadId(null);
+ runtime.setActiveProjectId(currentProjectId);
+ runtime.setIncognito(false);
+ navigate({
+ to: "/chat",
+ search: currentProjectId
+ ? { project: currentProjectId }
+ : { new: crypto.randomUUID() },
+ });
+ }, [currentProjectId, navigate]);
const openProjectsList = useCallback(() => {
navigate({ to: "/projects" });
}, [navigate]);
@@ -3250,12 +3265,31 @@ export function ChatPage({
? "pl-12"
: pinned
? "pl-2"
- : "pl-[calc(0.5rem+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]",
+ : isTauri
+ ? "pl-[var(--studio-collapsed-chat-controls-inset,0.75rem)]"
+ : "pl-[calc(0.5rem+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]",
view.mode === "compare" &&
"right-[10px] left-auto w-auto bg-transparent pl-0 pr-[calc(0.5rem+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
)}
>
<div className="pointer-events-auto flex items-center gap-1">
+ {isTauri && !isMobile && !pinned && view.mode !== "compare" && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ title="New chat"
+ aria-label="New chat"
+ onClick={handleDesktopNewChat}
+ className="!size-[33px] rounded-[10px] text-muted-foreground"
+ >
+ <HugeiconsIcon
+ icon={PencilEdit02Icon}
+ strokeWidth={1.75}
+ className="size-icon"
+ />
+ </Button>
+ )}
{view.mode !== "compare" && (
<ModelSelector
models={models}
diff --git a/studio/src-tauri/tauri.conf.json b/studio/src-tauri/tauri.conf.json
index 158a3698809..3b36ec93d71 100644
--- a/studio/src-tauri/tauri.conf.json
+++ b/studio/src-tauri/tauri.conf.json
@@ -29,7 +29,7 @@
"resizable": false,
"decorations": true,
"titleBarStyle": "Overlay",
- "trafficLightPosition": { "x": 14, "y": 24 },
+ "trafficLightPosition": { "x": 14, "y": 26 },
"hiddenTitle": true
}
]
diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.py
index f647c0c55fd..a4c282ebbb5 100644
--- a/tests/studio/test_desktop_reliability_frontend_contract.py
+++ b/tests/studio/test_desktop_reliability_frontend_contract.py
@@ -14,6 +14,8 @@ DATA_TAB = FRONTEND / "features/settings/tabs/data-tab.tsx"
PROMPT_STORAGE = FRONTEND / "features/chat/prompt-storage/prompt-storage-dialog.tsx"
APP_SIDEBAR = FRONTEND / "components/app-sidebar.tsx"
+SIDEBAR_PRIMITIVE = FRONTEND / "components/ui/sidebar.tsx"
+NAVBAR = FRONTEND / "components/navbar.tsx"
INDEX_CSS = FRONTEND / "index.css"
THREAD = FRONTEND / "components/assistant-ui/thread.tsx"
THREAD_SIDEBAR = FRONTEND / "features/chat/thread-sidebar.tsx"
@@ -340,8 +342,10 @@ def test_first_app_layout_survives_a_stale_setup_window_size():
def test_expanded_titlebar_button_and_corner_match_sidebar_edge():
source = TITLEBAR.read_text(encoding = "utf-8")
- assert 'pinned ? "gap-2 pl-3" : "justify-center"' in source
- assert "gap-2 px-3" not in source
+ assert 'showSidebarSurface && !pinned ? "7rem" : sidebarWidth' in source
+ assert "style={{ width: titlebarNavigationWidth }}" in source
+ assert "left: titlebarNavigationWidth" in source
+ assert "<DesktopTitlebarNavigation" in source
assert "const contentBorderLeft = pinned" in source
assert ': "0px";' in source
# The curved transition and sidebar-colored backing are expanded-only;
@@ -357,6 +361,79 @@ def test_expanded_titlebar_button_and_corner_match_sidebar_edge():
)
+def test_desktop_titlebar_separates_navigation_from_sidebar_brand():
+ titlebar = TITLEBAR.read_text(encoding = "utf-8")
+ sidebar = APP_SIDEBAR.read_text(encoding = "utf-8")
+ header = sidebar.split("<SidebarHeader", 1)[1].split("</SidebarHeader>", 1)[0]
+
+ assert 'import { ArrowLeft, ArrowRight } from "lucide-react";' in titlebar
+ assert "<ArrowLeft" in titlebar
+ assert "<ArrowRight" in titlebar
+ assert "window.history.back()" in titlebar
+ assert "window.history.forward()" in titlebar
+ assert 'src="/circle-logo-small.png"' in header
+ assert header.index("<DesktopTitlebarNavigation") < header.index('src="/circle-logo-small.png"')
+
+
+def test_collapsed_tauri_keeps_history_arrows_and_adds_new_chat_by_model_picker():
+ titlebar = TITLEBAR.read_text(encoding = "utf-8")
+ chat_page = CHAT_PAGE.read_text(encoding = "utf-8")
+ navigation = titlebar.split("export function DesktopTitlebarNavigation", 1)[1].split(
+ "export function WindowTitlebar", 1
+ )[0]
+
+ assert "{expanded && (" not in navigation
+ assert navigation.count('aria-label="Go back"') == 1
+ assert navigation.count('aria-label="Go forward"') == 1
+
+ assert "inline-flex size-[33px] shrink-0" in navigation
+
+ assert navigation.count("onDoubleClick={stopTitlebarDrag}") == 3
+ assert "maximized" not in navigation
+ assert "const maximizeRefreshSequence = useRef(0);" in titlebar
+ assert "const scheduleMaximizedRefresh = useCallback" in titlebar
+ assert "window.setTimeout(() =>" in titlebar
+ assert "scheduleMaximizedRefresh();" in titlebar
+
+ assert '"pl-3"' in titlebar
+ assert 'isTauri && !isMobile && !pinned && view.mode !== "compare"' in chat_page
+
+ assert "pl-[var(--studio-collapsed-chat-controls-inset,0.75rem)]" in chat_page
+ assert '"--studio-collapsed-chat-controls-inset": "188px"' in APP_PROVIDER.read_text(
+ encoding = "utf-8"
+ )
+ assert 'className="!size-[33px] rounded-[10px] text-muted-foreground"' in chat_page
+ assert 'aria-label="New chat"' in chat_page
+ new_chat_click = chat_page.index("onClick={handleDesktopNewChat}")
+ assert new_chat_click < chat_page.index("<ModelSelector", new_chat_click)
+
+
+def test_tauri_collapse_removes_the_icon_rail_but_web_keeps_it():
+ app_sidebar = APP_SIDEBAR.read_text(encoding = "utf-8")
+ primitive = SIDEBAR_PRIMITIVE.read_text(encoding = "utf-8")
+ navbar = NAVBAR.read_text(encoding = "utf-8")
+
+ assert "collapseToZero={isTauri}" in app_sidebar
+ assert "collapseToZero = false" in primitive
+ assert 'collapseToZero ? "w-0" : "w-(--sidebar-width-icon)"' in primitive
+ assert "usesNativeMacTitlebar && !pinned" in navbar
+ assert "<DesktopTitlebarNavigation" in navbar
+
+ assert "top-px z-[60]" in navbar
+ assert "z-40 h-[48px]" in navbar
+
+ assert "windowFocused" not in navbar
+ assert "bg-[#d0d0d0]" not in navbar
+ assert "translate-y-[var(--studio-titlebar-navigation-offset-y,0px)]" in TITLEBAR.read_text(
+ encoding = "utf-8"
+ )
+ assert '"--studio-titlebar-navigation-offset-y": "2px"' in APP_PROVIDER.read_text(
+ encoding = "utf-8"
+ )
+ assert "aria-hidden={(hasPinMode && !pinned && collapseToZero) || undefined}" in primitive
+ assert "inert={(hasPinMode && !pinned && collapseToZero) || undefined}" in primitive
+
+
def test_visible_mac_sidebar_header_is_a_drag_region():
source = APP_SIDEBAR.read_text(encoding = "utf-8")
header = source.split("<SidebarHeader", 1)[1].split("</SidebarHeader>", 1)[0]
diff --git a/tests/studio/test_tauri_branding_contract.py b/tests/studio/test_tauri_branding_contract.py
index 958c58197fe..a70b7a57e34 100644
--- a/tests/studio/test_tauri_branding_contract.py
+++ b/tests/studio/test_tauri_branding_contract.py
@@ -71,9 +71,9 @@ def test_desktop_artwork_uses_plain_unsloth_lockups() -> None:
assert "unsloth" in source
assert "/studio.png" not in source
- titlebar = read(FRONTEND / "src/components/tauri/window-titlebar.tsx")
- assert "/rounded-512.png" in titlebar
- assert "Unsloth" in titlebar
+ sidebar = read(FRONTEND / "src/components/app-sidebar.tsx")
+ assert "/circle-logo-small.png" in sidebar
+ assert "unsloth" in sidebar
assert not (FRONTEND / "public/studio.png").exists()
branding = TAURI / "windows/branding"