The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): move the HUD's way out onto the bar and drop the strip above it
Brooklyn Nicholsonde322448ac43
diff --git a/apps/desktop/src/app/chat/composer/controls.test.tsx b/apps/desktop/src/app/chat/composer/controls.test.tsxindex cceb970b9ff..7e90654477a 100644--- a/apps/desktop/src/app/chat/composer/controls.test.tsx+++ b/apps/desktop/src/app/chat/composer/controls.test.tsx@@ -3,6 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'import type { ChatBarState } from '@/app/chat/composer/types'import { I18nProvider } from '@/i18n'+import { $hudMode } from '@/store/hud'import { applyWakeStartResult, applyWakeStatus, resetWakeWordState } from '@/store/wake-word'import { ComposerControls } from './controls'@@ -57,6 +58,44 @@ async function expectShortcutTooltip(label: string, shortcut: string) {afterEach(() => {cleanup()+ $hudMode.set(false)+})++// The HUD is a Spotlight bar a few hundred pixels wide: the four voice+// controls fold into one menu there, and the way out of HUD mode joins the+// row instead of floating above the bar in a reserved strip. The docked+// composer keeps every control inline and shows no exit.+describe('HUD mode', () => {+ it('keeps the voice controls inline and offers no exit in the docked composer', () => {+ renderControls()++ expect(screen.getByLabelText('Voice dictation')).toBeTruthy()+ expect(screen.getByLabelText('Read replies aloud')).toBeTruthy()+ expect(screen.queryByLabelText('Exit HUD mode')).toBeNull()+ expect(screen.queryByLabelText('Voice')).toBeNull()+ })++ it('folds them into one menu and offers the way out in the HUD', () => {+ $hudMode.set(true)+ renderControls()++ expect(screen.getByLabelText('Voice')).toBeTruthy()+ expect(screen.getByLabelText('Exit HUD mode')).toBeTruthy()++ // Folded away, not duplicated — the whole point is the row's width back.+ expect(screen.queryByLabelText('Voice dictation')).toBeNull()+ expect(screen.queryByLabelText('Read replies aloud')).toBeNull()+ })++ // A collapsed menu that looked idle while the mic was open would be a worse+ // trade than the space it saves, so the trigger reports the live state.+ it('reports a live voice state on the collapsed trigger', () => {+ $hudMode.set(true)+ renderControls({ voiceStatus: 'recording' })++ expect(screen.getByLabelText('Stop dictation')).toBeTruthy()+ expect(screen.queryByLabelText('Voice')).toBeNull()+ })})describe('ComposerControls shortcut tooltips', () => {diff --git a/apps/desktop/src/app/chat/composer/controls.tsx b/apps/desktop/src/app/chat/composer/controls.tsxindex c5ce2c24624..baf71028ec2 100644--- a/apps/desktop/src/app/chat/composer/controls.tsx+++ b/apps/desktop/src/app/chat/composer/controls.tsx@@ -7,7 +7,7 @@ import { useI18n } from '@/i18n'import { triggerHaptic } from '@/lib/haptics'import { AudioLines, Ear, EarOff, iconSize, Layers3, Loader2, Square, Volume2, VolumeX } from '@/lib/icons'import { cn } from '@/lib/utils'-import { $hudMode } from '@/store/hud'+import { $hudMode, closeHud } from '@/store/hud'import { $wakeWord, toggleWakeWord } from '@/store/wake-word'import { ACTIVE_ICON_BTN, GHOST_ICON_BTN, PRIMARY_ICON_BTN } from './control-classes'@@ -153,10 +153,37 @@ export function ComposerControls({</Button></Tip>)}+ {/* The way out of HUD mode, riding the controls row rather than floating+ above the bar. The old chip lived in a 26px transparent strip reserved+ over the composer (--hud-chip-strip), which under glass is bare+ untinted material with a hidden button in it — a band of chrome above+ the surface, paid for in every state, for a control that is invisible+ until hovered. Here it costs no reserved space and sits with the other+ things you can press. */}+ {hudMode ? <ExitHudButton /> : null}</div>)}+function ExitHudButton() {+ const { t } = useI18n()++ return (+ <Tip label={t.titlebar.exitHud}>+ <Button+ aria-label={t.titlebar.exitHud}+ className={cn(GHOST_ICON_BTN, 'p-0')}+ onClick={closeHud}+ size="icon"+ type="button"+ variant="ghost"+ >+ <Codicon name="screen-normal" size="0.875rem" />+ </Button>+ </Tip>+ )+}+function ConversationPill({disabled,level,diff --git a/apps/desktop/src/app/hud/hud-shell.tsx b/apps/desktop/src/app/hud/hud-shell.tsxindex 9b5d1755039..0053d2cb9b7 100644--- a/apps/desktop/src/app/hud/hud-shell.tsx+++ b/apps/desktop/src/app/hud/hud-shell.tsx@@ -2,18 +2,12 @@ import { useStore } from '@nanostores/react'import { type CSSProperties, useCallback, useEffect, useRef, useState } from 'react'import { useNavigate } from 'react-router'-import { TitlebarIcon } from '@/app/shell/titlebar-icon'-import { Button } from '@/components/ui/button'-import { Tip } from '@/components/ui/tooltip'-import { useI18n } from '@/i18n'import { chatMessageText } from '@/lib/chat-messages'-import { closeHud } from '@/store/hud'import { $activeSessionAwaitingInput } from '@/store/prompts'import { $busy, $messages } from '@/store/session'import { RICH_INPUT_SLOT } from '../chat/composer/rich-editor'import { WiredPane } from '../contrib/wiring'-import { titlebarButtonClass } from '../shell/titlebar'import { useHudClickThrough } from './click-through'import { useHudGlass } from './glass'@@ -170,7 +164,6 @@ function useHudHeld(): boolean {* `useRecentActivity`).*/export function HudShell() {- const { t } = useI18n()const [recent, holdBand] = useRecentActivity()const held = useHudHeld()@@ -388,22 +381,6 @@ export function HudShell() {<WiredPane part="chatRoutes" />- {/* The way back — without it the only exits are ⌘⇧H and ⌘W, both- invisible. Placed and revealed entirely from styles.css. */}- <Tip label={t.titlebar.exitHud}>- <Button- aria-label={t.titlebar.exitHud}- className={`${titlebarButtonClass} absolute z-20`}- data-hud-exit=""- onClick={closeHud}- size="icon-titlebar"- type="button"- variant="ghost"- >- <TitlebarIcon name="screen-normal" />- </Button>- </Tip>-{/* The resize handle: bottom-right corner, the one sanctioned way tochange the HUD's size. Invisible chrome — a hot corner, not abutton — so it never reads as part of the surface. `data-hud-grabbing`diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.cssindex ada6d1d210c..fdedeb3ceaf 100644--- a/apps/desktop/src/styles.css+++ b/apps/desktop/src/styles.css@@ -2503,12 +2503,6 @@ button[data-slot='aui_msg-reactions'] svg {/* The band is narrower than the bar, centred under it, so the bar's cornercontrols sit clear of the sheet's edge instead of on top of it. */--hud-band-inset: 0.5rem;- /* Clear space above the composer for the exit chip. */- --hud-chip-strip: 1.625rem;- /* How long the exit chip stays after you stop pointing at the HUD. Long- enough to cross the gap between the bar and the chip without it- evaporating, short enough that it isn't furniture. */- --hud-exit-hold: 600ms;}/* Chat surface carries nothing in HUD mode — the visual is the BAND below. */@@ -2849,17 +2843,10 @@ button[data-slot='aui_msg-reactions'] svg {Parked in the top half of the screen (data-hud-edge='top', broadcast bymain on move/resize), the whole HUD mirrors vertically: composer hugs thewindow's top edge, the band hangs BELOW it, and text melts at the bottom.- Same surfaces, same variables — only the anchors swap.-- The bar would sit flush against the window's top edge, leaving no "above the- composer" to put anything in — which is where the exit chip belongs. Reserve- the strip as dock padding rather than moving the bar: --hud-bar-height is- measured from the dock's box, so the band's offset picks the gap up on its- own instead of needing a second variable kept in sync. */+ Same surfaces, same variables — only the anchors swap. */[data-hud-shell][data-hud-edge='top'] [data-slot='composer-dock'] {top: 0 !important;bottom: auto !important;- padding-top: var(--hud-chip-strip) !important;}/* Flipped, the band hangs from the bar instead of standing on it. */@@ -3074,128 +3061,17 @@ button[data-slot='aui_msg-reactions'] svg {}/* The exit button. HUD mode has no titlebar, so this is the only visible way- back; it rides the bar's outer edge at the right.-- It wears the BAR'S material, not the desktop's. Every shipped control that- floats over content the app does not own resolves this the same way — give- the control its own substrate and let the glyph read against that, never- against the backdrop:-- - Apple HIG, Materials: "Materials help visually separate foreground- elements, such as text and controls, from background elements." Controls- sit ON a material, never directly on content; even `clear` Liquid Glass- is specced with a 35%-opacity dimming layer behind it over bright- content.- https://developer.apple.com/design/human-interface-guidelines/materials- - Firefox picture-in-picture, the closest analogue we have (a small- always-on-top window over arbitrary content): the close/unpip buttons- are `background-color: rgba(255,255,255,.8)` with a `#000` glyph — an- opaque chip, not a bare icon.- toolkit/themes/shared/pictureinpicture/player.css- - Discord's overlay redesign: "This layer provided contrast against the- game making the UI easier to see."- https://discord.com/blog/redesigning-the-discord-overlay-- Anything that instead tries to derive contrast from the backdrop is a dead- end here. mix-blend-difference composites against the PAGE behind the- element, and behind a transparent Electron window that is nothing — the- desktop is composited by WindowServer after Chromium has finished drawing- the frame (the same reason backdrop-filter can't frost the HUD). A glyph- halo has the same flaw from the other side: it guesses one backdrop- luminance and is grime over everything else.-- So: the composer bar's exact tokens — same fill, same hairline, same bottom- shadow. The bar is the HUD's solved case for "our surface, over an unknown- desktop, in either appearance", and theme plus OS light/dark (mode 'system')- come free with it, because --dt-card and --ui-text-primary are the pair the- whole app is built on. The chip inverts with the appearance instead of- betting on one.-- Placed from --hud-bar-height rather than CSS anchor(). Lightning CSS drops a- whole rule containing an `anchor()` on the vertical axis, so the flipped-edge- override never reached the browser and the chip rendered off screen. */-[data-hud-shell] [data-hud-exit] {- left: auto;- top: auto;- right: 0.375rem;- bottom: calc(var(--hud-bar-height, var(--composer-fallback-height)) + 0.375rem);- /* Square. `size="icon-titlebar"` sizes width and height from two DIFFERENT- vars (--titlebar-control-size / --titlebar-control-height, 20x22 today),- which is right in a titlebar row and reads as a dent on a lone floating- chip — so height comes off the width instead. */- aspect-ratio: 1 / 1;- height: auto;- background: var(--dt-card) !important;- border: 1px solid var(--ui-stroke-secondary) !important;- border-radius: 0.5rem;- box-shadow: 0 2px 2px -1px rgb(0 0 0 / 0.12);- color: var(--ui-text-primary) !important;- /* Gone until you reach for the HUD. A permanent chip is a fragment of Hermes- parked on top of whatever you are really working in; reaching for the bar- is the motion that means "I want the app", so that is what brings the way- out with it. Hover, not focus — the gate #81893 warned about made the- escape hatch depend on the caret landing in the composer, broken exactly- when you most want out, whereas pointing at the bar needs nothing to be- working.-- `visibility`, not opacity alone: an always-on-top window eats clicks- wherever the page hands the hit test something real, so a 0-opacity chip- with `pointer-events: auto` would be an invisible button in the corner- that drops you out of HUD mode when you click the app behind it.- `visibility: hidden` takes it out of `elementFromPoint` as well as off the- screen, and it transitions discretely, so it flips in step with the fade- rather than needing a second mechanism. */- opacity: 0;- visibility: hidden;- /* Leaving holds first. The chip sits 0.375rem clear of the bar, so the- cursor crosses shell dead space on its way up from the bar to the chip and- both hover triggers are false for that moment — without the hold it would- fade out from under a hand that is on its way to press it. */- transition:- opacity var(--hud-fade) var(--hud-ease-exit) var(--hud-exit-hold),- visibility 0s linear calc(var(--hud-exit-hold) + var(--hud-fade)),- background-color var(--hud-reveal) var(--hud-ease-enter);- pointer-events: auto;-}--/* Flipped, "above the composer" is the reserved strip at the top of the- window rather than a gap the band has to leave. */-[data-hud-shell][data-hud-edge='top'] [data-hud-exit] {- bottom: auto;- top: 0;-}--/* What counts as reaching for it: the bar, the transcript band, or the chip- itself. The band only answers `:hover` while it is on screen (faded out it- is `pointer-events: none`), so this can't reveal the chip over a HUD that- isn't there. The chip's own hover is in the set so arriving re-asserts the- reveal that the hold above was covering for.-- Hovering the shell at large is deliberately NOT a trigger — most of the- HUD's rectangle is empty window over someone else's app, and it is- `pointer-events: none` precisely so the cursor passing through means- nothing. */-[data-hud-shell]:has([data-slot='composer-dock']:hover) [data-hud-exit],-[data-hud-shell]:has([data-slot='composer-bounds']:hover) [data-hud-exit],-[data-hud-shell] [data-hud-exit]:hover,-[data-hud-shell] [data-hud-exit]:focus-visible {- opacity: 1;- visibility: visible;- transition-duration: var(--hud-reveal), 0s, var(--hud-reveal);- transition-delay: 0s;-}--/* Hover and focus-visible: the app's own control-hover tint, so pointing at it- confirms it is a button with the same feedback every other icon button in- Hermes gives. Layered OVER the card rather than replacing it —- --ui-control-hover-background is a translucent color-mix meant to sit on an- opaque titlebar, and here the button IS the opaque surface, so assigning it- directly would make the chip see-through on hover. */-[data-hud-shell] [data-hud-exit]:hover,-[data-hud-shell] [data-hud-exit]:focus-visible {- background:- linear-gradient(var(--ui-control-hover-background), var(--ui-control-hover-background)), var(--dt-card) !important;-}+ back — it rides the composer's controls row (see ExitHudButton in+ composer/controls.tsx) and therefore needs no placement, no reveal, and no+ substrate of its own here: it is one of the bar's buttons and wears what+ they wear.++ It used to float above the bar in a reserved 26px strip, hidden until you+ hovered. That strip was transparent window, which the glass band then+ rendered as a slab of bare untinted material across the top of the HUD, and+ the chip needed its own opaque card to be legible over an unknown desktop.+ Both problems were the placement, not the button: on the bar it is already+ on our surface. *//* The corner resize handle — a hot corner, not a button. The window is creatednon-resizable (the transparent-frameless Windows drag-growth bug), so this