UI conventions: painting on the desktop
This page is generated from the project corpus and rewritten on every docs build. Edit the source in corpus/, not here.
Section 9 of ui-conventions.md, moved here when that page passed 200 lines. The rule numbers stay as they were, so "§47" still means the first rule below. The sticky-notes work (2026-08-05) is the worked example.
- An app may paint outside its window, and only through
desktopLayer. SetdesktopLayeron your manifest (contract.ts:41, added by the sticky-notes work (2026-08-05)) and core mounts it on the desktop with no import of your package — the same seam ascommandSources.Desktop.tsxcollects the layers fromuseEnabledApps()and renders each inside onepointer-events-none absolute inset-0wrapper with<Suspense fallback={null}>, placed after the icon container and beforeWindowContainer. The three rules that follow from that, all of them load-bearing:- It is mounted always, whether or not the app's window is open. Return
nullcheaply when you have nothing to draw; do not poll, and share the app's existing react-query cache rather than opening a second one. - The wrapper is
pointer-events-none, so the layer never eats a click meant for the wallpaper or an icon. Every interactive element inside opts back in withpointer-events-autoon itself (sticky-notes/src/DesktopNote.tsx:97) — including any dialog the layer renders (DesktopNotes.tsx). - It sits above the icon grid (which spans the whole desktop and would otherwise intercept everything) and below every window, so windows always win the z-order.
Verify that by resolving a point inside an open window with
elementFromPoint, not by eyeballing it.
- It is mounted always, whether or not the app's window is open. Return
- A desktop object needs a way back. Anything the user can drag must be clamped inside the desktop on commit (
sticky-notes/src/noteGeometry.ts, which keeps the clamp pure and tested because a note dropped off the edge cannot be recovered by any gesture) — a note dropped past the edge is unreachable after a reload — and must be removable from the desktop without being destroyed. Keep the two verbs distinct and label them so: "take off the desktop (the note is kept)" vs. "delete". Persist a drag or resize once on release, never per pointer move, and usesetPointerCaptureso a fast gesture off the element does not drop (sticky-notes/src/usePointerDrag.ts).
Start's layout and shared sources (2026-11-06)
Brief 72. Start is a search box, a Pinned grid (three columns), an A-Z list
with letter headings, then Recent; it is 320px wide, at most the viewport
less 16px. Pins live in the imbatranimos:start-pins dotfile; the defaults
are Files, Terminal, Browser, Code Editor, Notepad and Settings. Start and the
command palette read the same core sources (shared/commands/coreSources.ts),
so a search finds the same things in both. Right-click, or Android's
long-press, opens Open, Pin or Unpin and the Linux actions. Focus lands on
the first entry on a coarse pointer, on the search box otherwise. Known
smell: role=menu holds a searchbox.