From 4a4c75c5469f89cb72e279b44686b930a6785b6c Mon Sep 17 00:00:00 2001 From: broisnees Date: Tue, 24 Nov 2026 06:03:07 +0000 Subject: [PATCH] Zoom the title bar with the app and unstick the zoom pill TitleBar was counter-zoomed (zoom: 1/scale) to stay at 100% like an OS title bar, so at 200% its menus, workspace switcher, window buttons and the macOS tab strip were half the size of the UI under them, and the sidebar's top row (fixed --app-titlebar-h) overflowed its own buttons. The bar now zooms; --app-titlebar-h is 38px/36px x --app-scale; the macOS traffic-light spacer stays a fixed 78px because the OS draws the lights at a fixed size; Windows caption buttons scale their 46px width with the height. ZoomIndicator kept a hovered flag that only pointerleave cleared. When that event never came (Reset unmounting under the pointer, focus loss, the pill opening under a still pointer) the hide timer never fired again. It now checks :hover when the timer fires, and Reset, Escape, an outside click and window blur close it. --- .changeset/zoom-titlebar.md | 3 ++ src/lib/components/StudioShell.svelte | 10 ++--- src/lib/components/TitleBar.svelte | 33 +++++---------- src/lib/components/WindowControls.svelte | 5 ++- src/lib/components/ZoomIndicator.svelte | 54 ++++++++++++++++++++---- 5 files changed, 67 insertions(+), 38 deletions(-) create mode 100644 .changeset/zoom-titlebar.md diff --git a/.changeset/zoom-titlebar.md b/.changeset/zoom-titlebar.md new file mode 100644 index 00000000..2ac357d8 --- /dev/null +++ b/.changeset/zoom-titlebar.md @@ -0,0 +1,3 @@ +### Bug Fixes +- **Title bar at high zoom** - The title bar zooms with the rest of the app again. At 200% its menus, workspace switcher, window buttons and, on macOS, the open tabs stayed at 100% next to a 200% sidebar. The sidebar's top row now stays level with the bar and fits its buttons at every zoom. +- **Zoom pill no longer sticks** - The zoom level pill could stay on screen for good after clicking Reset or when it opened under the pointer. It now closes 2 seconds after the pointer leaves it, and right away on Reset, Escape, a click elsewhere, or when the window loses focus. It sits just under the title bar. diff --git a/src/lib/components/StudioShell.svelte b/src/lib/components/StudioShell.svelte index dcc3aed9..380bfe58 100644 --- a/src/lib/components/StudioShell.svelte +++ b/src/lib/components/StudioShell.svelte @@ -1183,11 +1183,11 @@ // lights, "History") and no status bar. Using the table view's heights there // left the AI header showing above inset pages (shortcuts, connections) and // its footer below them. - // The title bar is a fixed height at every zoom (TitleBar counter-zooms it), - // in AI mode too. - // Titlebar stays crisp desktop height: 38px on macOS (matches native - // unified toolbar / traffic lights), 36px on Windows/Linux. - root.style.setProperty('--app-titlebar-h', IS_MAC ? '38px' : '36px') + // The title bar is 38px on macOS (the traffic lights' row) and 36px on + // Windows and Linux at 100%, and grows with the app zoom like everything + // under it, in AI mode too. The sidebar's top row and the inset pages use + // the same value, so they stay level with the bar and fit their buttons. + root.style.setProperty('--app-titlebar-h', `calc(${IS_MAC ? 38 : 36}px * var(--app-scale, 1))`) // The status bar is h-7 (28px at 100%), growing cleanly with app zoom. root.style.setProperty('--app-statusbar-h', !aiMode && statusBarVisible ? 'calc(var(--spacing) * 7)' : '0px') }) diff --git a/src/lib/components/TitleBar.svelte b/src/lib/components/TitleBar.svelte index daf37ac5..e6c5e18c 100644 --- a/src/lib/components/TitleBar.svelte +++ b/src/lib/components/TitleBar.svelte @@ -3,12 +3,11 @@ import { onMount } from 'svelte' import MessageSquare from '@lucide/svelte/icons/message-square' import { cn } from '$lib/utils.js' - import { getAppScale } from '$lib/app-zoom.js' import { detectOs } from '$lib/platform.js' import { isTrialActive, licenseStatus } from '$lib/stores/license.js' import Logo from './Logo.svelte' import AppMenuBar from './AppMenuBar.svelte' - import { appMenuBar, appZoom } from '$lib/stores/settings.js' + import { appMenuBar } from '$lib/stores/settings.js' import WindowControls from './WindowControls.svelte' import TitleBarMenu from './TitleBarMenu.svelte' import WorkspaceSwitcher from './WorkspaceSwitcher.svelte' @@ -95,24 +94,12 @@ let titleW = $state(0) const showTitle = $derived(crumbRoom > 0 && crumbRoom >= Math.min(titleW, 96)) - // Fixed px like the bar itself: the macOS bar is a fixed 38px, so a rem - // control (42px at 150%) overflowed it. One 28px row at every zoom. - // The title bar never zooms, like the OS's own: the traffic lights beside it - // are drawn at 100% whatever the app zoom, so a bar that grew with the UI - // overflowed them (menus, workspace name and buttons all ballooned). It is - // counter-zoomed by 1/scale; its few px sizes are written × scale above so - // they land back on whole pixels. Menus it opens are portaled and still zoom. - // Tailwind's spacing (p-*, gap-*, h-*, size-*) is rem, and WebKitGTK does - // not apply `zoom` to rem lengths: on Linux the counter-zoom shrank the text - // back but left padding and gaps at the zoomed size, so the menu row spread - // out at every zoom step. Inside the bar the spacing unit is px x scale - // instead (style below), which every engine zooms back to the same 4px. - // Read in the same frame: applySettings sets --app-scale before it updates - // appZoom. Deferring it a frame made the bar jump after every zoom step. - const chromeZoom = $derived.by(() => { - void $appZoom - return 1 / getAppScale() - }) + // The bar zooms with the rest of the UI. It used to be counter-zoomed to stay + // at 100% like an OS title bar, but at 200% that left the menus, workspace + // switcher and (on macOS) the open tabs at half the size of everything below + // them. Its height is --app-titlebar-h (StudioShell), which scales too, so the + // sidebar's top row and the inset pages stay level with it. Inside the bar the + // spacing unit is 4px x scale, the size it always had at 100%. const iconBtn = 'inline-flex size-[calc(26px*var(--app-scale))] items-center justify-center rounded-md text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground active:bg-foreground/[0.1]' @@ -124,9 +111,8 @@ style) floating over this bar, so it only reserves space for them here. -->