covers:
- apps/desktop/src/panels/**
Desktop Panels
Overview
The desktop panel subsystem is the set of GPUI render entities exported from apps/…/mod.rs: Browser, Preview, Inspector, and Timeline. Each panel is a small Render implementation that builds a themed div and is intended to be composed by the desktop shell rather than instantiated inline during each render.
Composition happens in apps/…/shell.rs, which imports the four panel types from crate::panels, creates one Entity<T> for each in Shell::new, and then reuses cloned entity handles in Shell::render. The shell lays out the workspace as a full-window vertical flex container: the top two-thirds is a horizontal row containing Browser, Preview, and Inspector; the bottom third is Timeline. The comment in apps/…/shell.rs is important for panel behavior: panels are created once so any state added to a panel entity later survives rerenders instead of being torn down every frame.
The individual panel files define the current visual regions:
- apps/…/browser.rs renders the left sidebar with
w_1_4, full height, a right border,colors.sidebar,colors.sidebar_foreground, andcolors.sidebar_border, currently showing the placeholder textBrowser. - apps/…/preview.rs renders the central preview region with
w_1_2, full height,colors.background, and the placeholder textPreview. - apps/…/inspector.rs renders the right sidebar with
w_1_4, full height, a left border,colors.card,colors.card_foreground, andcolors.border, currently showingInspector. - apps/…/timeline.rs renders the bottom strip with
h_1_3,colors.card,colors.card_foreground, and the placeholder textTimeline.
All panels use crate::theme::ActiveTheme to read window.theme().colors, so their colors follow the active WindowAppearance through apps/…/theme.rs. The panels currently hold no fields and perform no persistence, I/O, or external service calls; state is limited to the GPUI entity identity created by the shell and any future state added to these structs.
Coupling
- If a panel type is renamed, moved, or made public/private differently under
apps/desktop/src/panels/**, update apps/…/mod.rs and theuse crate::panels::{Browser, Inspector, Preview, Timeline};import in apps/…/shell.rs; otherwise the shell will stop compiling even though the panel implementation still exists. - If panel sizing changes in apps/…/browser.rs, apps/…/preview.rs, apps/…/inspector.rs, or apps/…/timeline.rs, verify the corresponding parent layout in apps/…/shell.rs. The shell assumes the top row is
h_2_3and the timeline is the remaining bottom panel, while the top-row panels currently divide width as one-quarter, one-half, one-quarter. - If panels gain mutable UI state, keep the entity creation pattern in apps/…/shell.rs aligned with that state. Creating
Browser,Preview,Inspector, orTimelinedirectly insideShell::renderwould reset panel state on every frame. - If semantic theme fields are renamed or removed in apps/…/theme.rs, update each panel that reads those fields.
Browseruses sidebar-specific colors, whilePreview,Inspector, andTimelineuse the shared background/card/border tokens, so theme token changes can alter panel contrast or borders without touching the panel files.