macos
ui · paida menu bar app performed on a Mac screen, played or as a still
npx shadcn add @ag/macosA paid item: its source installs with a licence key, kept in .env.local as AG_LICENCE_KEY and sent from components.json. The source stays in your project and out of any public repository. The licence
{
"registries": {
"@ag": {
"url": "https://ui.adriangalilea.com/r/{name}.json",
"headers": { "Authorization": "Bearer ${AG_LICENCE_KEY}" }
}
}
}Already installed? Preview an update
npx shadcn add @ag/macos --dry-runYour installed source stays unchanged until you update it. How updates work
- The terminal windows are app-window's
AppWindow(new dependency@ag/app-window): the same window, its buttons 12 px as a Mac's (were 10 px) and its bar 28 px tall; its root'sdata-slotisapp-window(wasmacos-terminal). - Changed: the menu bar's clock reads as a Mac's does, the date and the time in the viewer's locale, its order and its hour cycle (
Thu Nov 5 8:13 PMin en-US,jue 5 nov 20:13in es-ES), where it said only an English8:13 PM. The lock screen's time and date and the shut lid's clock are spelled the same way. A story's ownHH:MMkeeps its time of day in the viewer's hour cycle, and its date turns at each midnight the story runs past. - The viewer's clock now moves with one timer to each next minute, only while the stage is on screen in a visible tab (it polled every 15 seconds). The server draws no time and the browser fills it in once hydrated, in a slot already as wide as the widest en-US time, so nothing in the menu bar moves.
- New:
time, a frozen instant for a still or a film frame, so its picture never depends on when it was drawn;locale(BCP 47) andtimeZone(IANA) spell and read it.scripts/macos-film.tstakes--time,--localeand--zone, by default2026-09-30T09:41:00Z, en-US, UTC. - Changed: the battery is macOS's glyph, drawn as SVG in the menu bar's ink at its size: an outlined body, the terminal's nub, the charge a fill as long as the level, red at 20% and under, and the bolt over it while charging, the fill cut away around it. Installing
macosnow pulls@ag/use-on-screen. - Fixed: a MacBook whose lid folds shows its whole top. The stage clipped its frame to the open box, so a lid rising above it under the perspective lost its top edge and the menu bar's; it clips now only while the camera zooms.
also called menubar
shelf devices & demos
comes with macos-session
uses image, thermal, terminal-session, device-frame, agent-session, kbd, playback, person, avatar, video, wallpaper, use-on-screen, app-window
the demo above, verbatim
"use client"
import * as React from "react"
import { Sample } from "@/app/samples"
import artJson from "@/public/macos/awake/art.json"
import heroJson from "@/public/macos/awake/hero.json"
import lidYoursJson from "@/public/macos/awake/lid-yours.json"
import menuBarJson from "@/public/macos/awake/menu-bar.json"
import safetyNetsJson from "@/public/macos/awake/safety-nets.json"
import chillArtJson from "@/public/macos/chill/art.json"
import chillHeroJson from "@/public/macos/chill/hero.json"
import {
type Art,
frameAt,
sceneClock,
type Timeline,
} from "@/registry/base-nova/lib/macos-session"
import { ClaudeCode } from "@/registry/base-nova/ui/claude-code"
import { Codex } from "@/registry/base-nova/ui/codex"
import { Macos, type MacosDevice } from "@/registry/base-nova/ui/macos"
import { Player } from "@/registry/base-nova/ui/player"
import { ScrollArea } from "@/registry/base-nova/ui/scroll-area"
// #region scenes
// Real timelines, not hand-written ones: awake compiles them from its scene scripts
// through its own engine (`mise scene` in the awake repo writes public/macos/awake/),
// and art.json is its glyphs and icon drawn by its own code. `mise scene:watch` there
// recompiles on every save, and this page picks the file up.
const SCENES = {
hero: heroJson,
"menu-bar": menuBarJson,
"lid-yours": lidYoursJson,
"safety-nets": safetyNetsJson,
} as Record<string, Timeline>
const ART = artJson as Art
// The agents a story may open in its terminal: the page picks the skins.
const AGENTS = { claude: ClaudeCode, codex: Codex }
// #endregion
// #region heat
// A scene's heat is steps like any other (`thermal`: a reading the stage glides
// between, a `depth` for how deep it looks), folded at the playhead with the lid,
// the camera and the captions. chill's hero is one simulation (`mise scene` in the
// chill repo writes public/macos/chill/): its popover, a clip its own views
// rendered, and the heat in the base, Apple's curve then chill's, with chill's own
// glyph in the menu bar.
const CHILL_HERO = chillHeroJson as Timeline
const CHILL_ART = chillArtJson as Art
// #endregion
// #region desktop
// A Mac with no story on it, so its menu bar reads the time it is given. A story's
// world sets the battery: one step, the level and whether it is charging.
const NO_ART: Art = { icon: "", glyphs: {} }
const desktop = (battery: number, charging: boolean): Timeline => ({
app: "Finder",
chord: "",
steps: [
{
kind: "world",
world: { battery, charging, lid: "open", asleep: false, heat: false },
},
],
})
const DESKTOP = desktop(80, false)
// A still's instant, read in a named zone: the picture is the same whenever and
// wherever it is drawn.
const STILL = new Date("2026-11-05T20:13:00Z")
// #endregion
export default function MacosDemo() {
return (
<div className="space-y-16">
<Sample
name="played"
title="in a player"
description="plays once, in view"
with="scenes"
>
<Played
timeline={SCENES["lid-yours"] as Timeline}
alt="awake: a coding agent asks to survive lid close, you allow it from the menu, close the lid, and the Mac sleeps when the agent exits"
/>
</Sample>
<Sample
name="macbook"
glance="large"
title="on a macbook"
description="the lid folds when the scene closes it"
with="scenes"
>
<Played
timeline={SCENES["safety-nets"] as Timeline}
device="macbook"
alt="awake: held awake with the lid shut in a bag, it sleeps when it gets too hot, and again when the battery runs low"
/>
</Sample>
<Sample
name="heat"
title="heat"
description="chill's hero: the popover and the heat, one story"
with="heat"
>
<Played
timeline={CHILL_HERO}
art={CHILL_ART}
accent="#cfc5b4"
device="macbook"
alt="chill: under load the case heats up while Apple's fans sit at their floor; pressing chill hands the fans to its curve and the Mac cools under the same load"
/>
</Sample>
<Sample
name="display"
title="on a display"
description="the panel sleeps instead"
with="scenes"
>
<Played
timeline={SCENES["menu-bar"] as Timeline}
device="display"
alt="awake: right-click the cup, ⌃⌥⌘A or the awake command flip the same switch, and the menu shows what holds the Mac awake"
/>
</Sample>
<Sample
name="clock"
title="your clock"
description="in your locale and hour cycle, turning on the minute"
with="desktop"
>
<Macos
timeline={DESKTOP}
art={NO_ART}
progress={1}
captions={false}
alt="A Mac's desktop, its menu bar showing the date and time where you are"
/>
</Sample>
<Sample
name="still"
title="a frozen still"
description="one instant in one zone, spelled in en-US and in es-ES"
with="desktop"
>
<div className="grid gap-6 md:grid-cols-2">
{["en-US", "es-ES"].map((locale) => (
<Macos
key={locale}
timeline={DESKTOP}
art={NO_ART}
progress={1}
time={STILL}
timeZone="UTC"
locale={locale}
captions={false}
alt={`A Mac's desktop at 20:13 on Thursday 5 November, its menu bar in ${locale}`}
/>
))}
</div>
</Sample>
<Sample
name="battery"
title="the battery"
description="charging at 64%, and at 12% on battery, red"
with="desktop"
>
<div className="grid gap-6 md:grid-cols-2">
<Macos
timeline={desktop(64, true)}
art={NO_ART}
progress={1}
time={STILL}
timeZone="UTC"
captions={false}
alt="A Mac's menu bar, its battery charging at 64%"
/>
<Macos
timeline={desktop(12, false)}
art={NO_ART}
progress={1}
time={STILL}
timeZone="UTC"
captions={false}
alt="A Mac's menu bar, its battery at 12% and red"
/>
</div>
</Sample>
<Sample
name="studio"
title="studio"
description="pick, scrub, step"
with="scenes desktop"
>
<Studio scenes={SCENES} art={ART} />
</Sample>
</div>
)
}
/** A scene in the player: the stage draws, the player moves time through its playable. */
function Played({
timeline,
art = ART,
accent = "#e7a13c",
device,
alt,
}: {
timeline: Timeline
art?: Art
accent?: string
device?: MacosDevice
alt: string
}) {
const clock = React.useMemo(() => sceneClock(timeline), [timeline])
return (
<Player playable={clock.playable} label={alt}>
<Macos
timeline={timeline}
art={art}
agents={AGENTS}
accent={accent}
device={device}
alt={alt}
/>
</Player>
)
}
/** The iteration surface: a scene at a chosen instant, its timeline as a list of steps
* to jump between, and play from wherever the cursor is. */
function Studio({
scenes,
art,
}: {
scenes: Record<string, Timeline>
art: Art
}) {
const [name, setName] = React.useState(Object.keys(scenes)[0] as string)
const [device, setDevice] = React.useState<MacosDevice | "screen">("macbook")
const timeline = scenes[name] as Timeline
const clock = React.useMemo(() => sceneClock(timeline), [timeline])
const [ms, setMs] = React.useState(0)
const [playing, setPlaying] = React.useState(false)
React.useEffect(() => {
if (!playing) return
let frame = 0
let last = performance.now()
const tick = (now: number) => {
setMs((v) => {
const next = v + (now - last)
if (next >= clock.total) setPlaying(false)
return Math.min(clock.total, next)
})
last = now
frame = requestAnimationFrame(tick)
}
frame = requestAnimationFrame(tick)
return () => cancelAnimationFrame(frame)
}, [playing, clock.total])
const current = frameAt(timeline, clock, ms).step
return (
<div className="grid gap-8 lg:grid-cols-[1fr_280px]">
<div className="space-y-4">
<Macos
timeline={timeline}
art={art}
agents={AGENTS}
progress={ms / clock.total}
time={STILL}
timeZone="UTC"
accent="#e7a13c"
device={device === "screen" ? undefined : device}
alt={`awake, scene ${name}`}
/>
<div className="flex items-center gap-3 font-mono text-xs lowercase">
<select
className="rounded-md border border-border bg-transparent px-2 py-1"
value={name}
onChange={(e) => {
setPlaying(false)
setMs(0)
setName(e.target.value)
}}
aria-label="scene"
>
{Object.keys(scenes).map((n) => (
<option key={n}>{n}</option>
))}
</select>
<select
className="rounded-md border border-border bg-transparent px-2 py-1"
value={device}
onChange={(e) =>
setDevice(e.target.value as MacosDevice | "screen")
}
aria-label="device"
>
<option>macbook</option>
<option>display</option>
<option>screen</option>
</select>
<button
type="button"
className="w-14 rounded-md border border-border px-2 py-1"
onClick={() => {
if (ms >= clock.total) setMs(0)
setPlaying((p) => !p)
}}
>
{playing ? "pause" : "play"}
</button>
<input
type="range"
className="flex-1"
min={0}
max={clock.total}
value={ms}
onChange={(e) => {
setPlaying(false)
setMs(Number(e.target.value))
}}
aria-label="scene position"
/>
<span className="w-24 text-right text-muted-foreground tabular-nums">
{(ms / 1000).toFixed(1)}s / {(clock.total / 1000).toFixed(1)}s
</span>
</div>
</div>
<ScrollArea
render={<ol />}
className="max-h-[520px] space-y-px font-mono text-xs"
>
{timeline.steps.map((s, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: steps are positional
<li key={i}>
<button
type="button"
className={
i === current
? "w-full rounded bg-foreground/8 px-2 py-1 text-left"
: "w-full rounded px-2 py-1 text-left text-muted-foreground hover:bg-foreground/4"
}
onClick={() => {
setPlaying(false)
setMs(clock.ends[i] as number)
}}
>
<span className="text-foreground/40 tabular-nums">
{((clock.starts[i] as number) / 1000).toFixed(1)}
</span>{" "}
{s.kind}{" "}
<span className="text-foreground/60">
{s.text ?? s.glyph ?? s.keys ?? s.world?.clock ?? ""}
</span>
</button>
</li>
))}
</ScrollArea>
</div>
)
}