The workbench
What an application’s window holds around its content: its own frame, the scale of each window, panels in areas, slim strips, panels detached into windows of their own, named arrangements, and the keymap changed at run time. Every change goes through a step (ADR 0011): a plugin may watch it on the journal, veto or redirect it, replace it or follow it.
Panels in areas
A plugin declares panels with their rules; the workbench places them in
areas (the centre, the start and end side bars, the bottom panel), as
tabs, rows, columns and grids over egui_stack
(the continuation of egui_dock),
saves where the user put them and repairs that layout at the next start.
A panel no longer declared (its plugin disconnected or not installed)
leaves the layout, but its place is kept dormant (SavedLayout::dormant:
docked in an area at its tab’s index beside the same panels, detached
on a screen, floating at a corner, or closed), saved with the layout,
and the panel goes back there when it is declared again (ADR 0028,
AppHandle::saved_layout, Layout::repair_dormant); the
log says each with a layout: info line.
The shell’s side bar, main and inspector zones are panels of their areas.
One dock space. The areas are the named docks of one egui_stack
DockSpace (center, start_side, end_side, bottom). The
workbench lays the areas out (a side area’s width, its fold and flyout,
an area lying over the centre, the bottom panel’s alignment) with
egui_stack’s layout layer: each area is a zone holding its dock, with
its least, largest and default sizes as constraints, the centre the zone
that grows, a folded side area the zone’s strip; the zones that hold no
dock refuse a dragged tab (DockSpace::bind). It draws each area’s dock
where the layout put the area; the docks share one drag, so a
tab goes from any area to any other as it goes inside one. Each area’s
rules are its dock’s: any split, as inside one area; never one of
egui_stack’s floating windows (a panel leaves the main window through
Detach, into a window of its own); kept when it is empty, so a closed
area stays a drop target. The layout document keeps one tree per area,
as before the space: a layout saved before reads as it did, each area’s
tree becoming its dock’s.
The starting layout. Without a saved layout, every panel starts in
its default area. AppBuilder::layout gives the layout to start with
instead (the panels’ areas, tabs and splits, the closed panels, the
folded areas), repaired against the declared panels as a saved layout
is; the Default arrangement resets to it. An application that does not
use the shell’s zone panels lists them as closed:
use egui_pop::api::workbench::{PANEL_INSPECTOR, PANEL_MAIN, PANEL_SIDE_BAR};
use egui_pop::model::ids::PanelId;
use egui_pop::model::layout::{Layout, Node};
use egui_pop::model::panels::Area;
use egui_pop::prelude::*;
const TREE: PanelId = PanelId::from_static("demo.tree");
const VIEW: PanelId = PanelId::from_static("demo.view");
let builder = App::builder()
.layout(Layout {
areas: vec![
(Area::StartSide, Node::tab(TREE)),
(Area::Center, Node::tab(VIEW)),
],
hidden: vec![PANEL_SIDE_BAR, PANEL_MAIN, PANEL_INSPECTOR],
..Layout::default()
})
// Every area runs to the window's edges, a line between them.
.frameless(&Area::ALL);
Frameless areas. An area has a margin around it, and each of its
panels’ bodies a margin and a rounded border (the kit’s dock-body).
AppBuilder::frameless takes both away for the areas it names, so their
panels run to the window’s edges and are set apart by the separator’s
line only (a viewer whose views draw to their edges); a panel then gives
itself the margin it wants. main_edge_to_edge takes away only the
centre’s outer margin.
Lines between panels. Two panels of one area meet at the dock’s
separator (the kit’s dock-separator); two areas meet at the layout’s
line between them, which the kit draws (as wide as the widgets’ border,
shown at rest only when side-area has a border). It lies inside the
side or bottom area, on its edge facing the centre, in the room the
area’s frame keeps for it, where egui drew a side panel’s separator
(Kit::paint_area_line); it takes the drag that resizes the area. Under the pointer and while dragged it is drawn from side-area.hover.border-* and side-area.active.border-* (a width of 0: no line), egui’s widget strokes when the kit says nothing. Those are the lines that mean something: the bodies’ borders
beside them only repeat them, and a kit that wants one line where two
panels meet sets dock-body.rest.border-width to 0, as the Rerun-like
kit does (it also hides the dock’s separator at rest).
Bare panels. A shell panel is declared bare (PanelSpec::bare): alone in
its area it is drawn plainly, with no tab bar and no scroll area from anyone. What
its blocks draw past its end is cut, and nothing says so. Beside another panel the
same content is in a tab, and egui_stack gives a tab’s body a scroll area on both
axes. So a block in SIDE_BAR, MAIN or INSPECTOR that may run long brings its
own scroll area, and one sized to what it is given stays inside it: a viewport
filling MAIN must not scroll. The gallery shows both: its pages get a scroll area
each, but for those filling the zone themselves (shell::FILLS_THE_ZONE).
use egui_pop::api::steps::Before;
use egui_pop::api::workbench::STEP_MOVE;
use egui_pop::egui;
use egui_pop::model::ids::PanelId;
use egui_pop::model::panels::{Area, PanelSpec};
use egui_pop::prelude::*;
const LOG: PanelId = PanelId::from_static("demo.log");
const TREE: PanelId = PanelId::from_static("demo.tree");
struct Demo;
impl Plugin for Demo {
fn id(&self) -> PluginId {
PluginId::from_static("demo")
}
fn connect(&mut self, ctx: &mut Ctx<'_>) -> Result<(), PluginError> {
// The log stays in the bottom panel; the tree may go anywhere.
ctx.panel(
PanelSpec::new(LOG, "Log", Area::Bottom)
.only_in(&[Area::Bottom])
.min_size(80.0),
|ui, _| {
ui.label("log");
},
)?
.panel(
PanelSpec::new(TREE, "Tree", Area::StartSide).default_size(220.0),
|ui, _| {
ui.label("tree");
},
)?;
// A veto: the tree never goes to the bottom panel.
ctx.before(STEP_MOVE, |_, args| {
if args["panel"] == "demo.tree" && args["area"] == "bottom" {
Before::Veto("the tree stays on a side".into())
} else {
Before::Go
}
});
Ok(())
}
}
let app = App::builder().plugin(Demo).build(&egui::Context::default()).unwrap();
let h = app.handle();
assert_eq!(h.layout().area_of(&LOG), Some(Area::Bottom));
// Refused by the panel's rules, then by the plugin, then done.
assert!(!h.move_panel(&LOG, Area::StartSide).unwrap().ok());
assert!(h.move_panel(&TREE, Area::Bottom).unwrap().vetoed().is_some());
assert!(h.move_panel(&TREE, Area::EndSide).unwrap().ok());
assert_eq!(h.layout().area_of(&TREE), Some(Area::EndSide));
A side area is never narrower than the largest PanelSpec::min_size of
its panels. The shell’s own panels (PANEL_SIDE_BAR, 120 points at
least; PANEL_INSPECTOR, 160) take the application’s sizes:
AppBuilder::shell_panel_size the width they start at,
shell_panel_min_size and shell_panel_max_size their least and
largest, in points or as a share of the window
(workbench::ShellSize::Share(0.6)). While the application runs,
AppHandle::set_shell_panel_min_size and set_shell_panel_max_size
change them (None puts back the default): a least width measured from
the panel’s content, which depends on the fonts and the text size, is
set there, each frame or when it changes, and the area widens to it on
the next pass. AppBuilder::centre_min_size
keeps the centre at least that wide: the side areas give way to it,
each down to its own least, and a window too narrow for all of them
squeezes the centre.
Each panel gets <id>.focus and <id>.toggle commands. AppHandle::focused_panel,
the context key focusedPanel, is the panel the keys obey; see
The focused panel. The layout
changes through the steps workbench.move, workbench.show,
workbench.hide, workbench.focus, workbench.fold,
workbench.place, workbench.flyout, workbench.flyout_size,
workbench.arrange and workbench.zen (egui_pop::api::workbench).
Drop zones. A tab dragged inside an area shows where it would go on
the group under the pointer itself, with no buttons: near an edge (in
egui_stack’s edge band), the half of the group a split would give it,
bordered and tinted; elsewhere the whole group, to join its tabs; over a
tab bar, the place among its tabs. The zone is the kit’s dock-preview
(its rest border and fill, the fill at its opacity), so it follows
the theme like the hint between areas; the same tokens feed egui_stack’s
OverlayStyle::zone_fill, zone_stroke and zone_corner_radius. A tab
dropped outside every area stays where it was. A drop on the edge of a
group in a row (a column) joins that row (that column) rather than
nesting a split, and a drop beside a group in a grid joins the grid.
Rows, columns and grids. An area holds groups of tabs in rows,
columns and grids, nested. “Arrange as grid” (workbench.arrange.grid)
lays out the row, column or grid holding the focused panel’s group in
rows and columns, row by row: as many columns as the square root of
their number, rounded up, or columns from the command’s arguments;
“Arrange as row” and “Arrange as column” (workbench.arrange.row,
workbench.arrange.column) lay them out again side by side or one above
the other. Each takes a panel argument for another group than the
focused panel’s, an agent’s way in; a group alone in its area has
nothing to arrange ({ "arranged": false }). They go through the
workbench.arrange step (panel, as: grid, row or column,
columns), AppHandle::arrange from code. The layout document saves a
grid as a node of kind grid (columns, col_shares, row_shares,
children); a row or column of more than two as splits nested on their
second side, each ratio the share of its first side. Layouts saved
before grids read as they did.
Between areas. A tab dragged onto another area gets the same zones
there, with the same preview: the middle of a group joins its tabs, an
edge splits the group on that side, a tab bar takes it between two tabs.
An area its panel stays out of (PanelSpec::only_in, or content the
area cannot host) refuses it: the zone shows disabled, with the reason
(“Log stays out of the start side bar”), and a drop there changes
nothing. A closed side or bottom area is offered along the areas’ edge
(a band of 48 points), an area drawn bare (a zone alone, without a tab
bar) over its whole rect: dropped there, the tab joins its tabs. Once
the tab is dropped in another area, the move goes through the
workbench.move step (panel, area): a plugin’s veto puts the tab
back where it was, a redirect sends it to the area the step names.
The refusal itself is asked on the application’s bus: the space has it
(egui_stack’s bus feature), and the workbench’s listener of
egui_stack’s stack.dock.drop (pop.workbench.dock_drop) says the panels’
rules; any listener of the point may refuse a drop, its reason shown on
the zone, asked when the drop’s destination changes and again at
release. The workbench follows the zones the user resized, folded or
unfolded, and the flyouts, from stack.layout.changed
(pop.workbench.stack_layout), on the same bus. A palette dragged over an area it docks in, with the dock keys held (see
Palettes, Dragging), shows the hint with a ghost of its tab (the kit’s
tab-preview) after the area’s first tabs.
The hint is published like an overlay: AppHandle::drop_hint (panel,
area, rect, refusal, zone, the egui_stack DropZone (Center to join
tabs, an edge to split), index among the tabs it would join, and for a
palette preview, its ghost’s area, index and rect, and armed:
whether a drop now docks, always for a tab), overlay_rects (kind
DropHint, named drop:<panel>:<area>, only while armed: a hint not
armed is not drawn), and the debug bridge’s workbench collector
(drop_hint: {name, panel, area, rect, refusal, zone, index, armed, preview}), which also shows the layout, each area’s rect, the focused
panel and the tab being dragged.
The focused panel
There is one per window: the panel the widget focus is in, or the last one
it was in. The main window and its detached panels share the workbench’s;
an application window keeps its own (empty while none of its panels was
focused), so the keys of a panel bound in the panel:<id> scope, or with a
when testing focusedPanel, never fire from another window (key
scopes).
when clauses reading focusedPanel follow the keyboard. Beside it,
focusedPanelKind is that panel’s kind (PanelId::kind): its own id, or
app.gallery while the instance app.gallery#2 has the focus, so a
clause focusedPanelKind == 'app.gallery' reaches every instance (see
Panel instances).
| What happens | focusedPanel | The widget focus |
|---|---|---|
| Tab or a widget takes the focus, in a panel | that panel | that widget |
workbench.focus, <panel>.focus, focus_panel | that panel, at once | in the next pass, see below |
| F6 or Shift+F6 (regions) | the panel it lands in | the region’s last, or as below |
Ctrl+Page Down or Up (workbench.tab.next, .previous) | the tab beside it in its group, wrapping | as below |
| A press in a panel | that panel | as the widget pressed decides |
| The focus goes to the menu, the status bar or a dock’s tab | unchanged | there |
| Escape, or the focused widget going away | unchanged | none |
| A panel closes while focused | none, or back from a palette | none |
Handing a panel the keyboard. It shows the panel, then gives the focus to
the widget the panel named with egui_pop::core::focus::prefer; without one, to
the panel itself, from which Tab enters its widgets. Never to its first
focusable widget unasked: a slider focused that way would take the wheel meant
to scroll the panel (classic applications focus the panel, not its first
control). If the focus is
in the panel already it stays where it is. Behind a modal, or when a command
from an agent, a script or a device finds someone typing in a field, only
focusedPanel moves. The focus lands a pass later, so the key that ran the command is not
typed into the field it lands on.
- A canvas is a widget like another: one that senses clicks or drags is
focusable, and a panel whose toolbar comes first says
focus::prefer(ui.ctx(), response.id)so the canvas gets the keyboard. The image viewport does, as do the library’s grid (over its filters) and a text editor (over its find bar). A panel with a search field first and a list below should do the same, and a search panel names its field, so a “go to the search” key lands in it. - Any other panel holds the focus itself: a stop named after the panel, drawn only while it holds the focus, so it is no extra Tab stop. Tab goes on from there into its widgets. It shows nothing yet (item 4 of the keyboard survey).
The last panel stays when the focus goes to something no panel holds. In
egui a menu’s items take the focus and nothing gives it back when it closes, and
Escape on any widget leaves nothing focused: if focusedPanel emptied, opening
a menu or pressing Escape would turn off every key of the panel worked in, and
a command in that menu would act on nothing. VS Code has both kinds of keys:
focusedView, sideBarFocus and panelFocus empty on blur, activeEditor,
activeViewlet and activePanel stay. focusedPanel is of the second kind.
Whether a widget holds the focus at all is widgetFocus.
Palettes and flyouts only borrow the keys. A press on one leaves them where
they were: a click on a palette’s background keeps the keys on the image, as in
an image editor. A widget of it taking the focus (a press on a field, Tab, its
.focus command) does move them, and when it lets go (Escape, a click
elsewhere, the palette closing) they go back to the panel of the layout that
had them.
Detached windows. egui keeps a focus per window. A widget taking the focus
in a window, a press in it or the window getting the system’s focus back moves
focusedPanel; <panel>.focus raises the panel’s window.
Following is a plain write, not a step: it cannot loop back through
workbench.focus. Each change, from either side, is published once as the event
workbench.focused ({ "panel" }).
A side area lies beside the centre, taking its room, or over
it (workbench.place, { "area", "placement": "over" };
AppHandle::place_area, AppBuilder::over for the first start): its
folded strip keeps the room in the layout, so the centre keeps its
width (a terminal in it is not resized), and the area, unfolded, lies
above the centre next to its strip, with the kit’s side-area shadow
(shadow.side). A click on the strip’s grip folds or unfolds it; its edge on
the centre’s side resizes it. The placement is saved with the layout
(over), like folding; a plugin may veto the step. The centre never
folds: workbench.fold refuses it.
The line between a side or bottom area lying beside the centre and the centre resizes the area: by a drag, or with the keyboard once Tab or Shift+Tab reaches it (“Resize the start side bar”, a splitter to assistive technology). An arrow across the line moves it 16 points, with Shift 64, and Enter or a double click gives the area its default size back, as a dock separator and a section’s boundary do. The sizes the user gave are kept with egui’s memory, as egui’s side panels kept theirs; a session saved when the areas were egui panels keeps its areas’ sizes.
Strip icons and flyouts
A side area’s strip (folded, or lying over the centre) shows one icon
per panel it holds, in tab order: the panel’s PanelSpec::icon, a
vector icon tinted by the kit’s activity-bar-item and crisp at any
scale, or its title’s first letter when it has none. The strip widens
to hold them. An icon’s tooltip gives the panel’s title and its key
(the first binding of <panel>.focus, else of <panel>.toggle), and
the icon is a button named by the title.
An application keeps a side area’s strip bare with
AppBuilder::bare_strips(&[Area::StartSide]): its grip glyph alone,
area-strip.width wide, no icon per panel, and a click unfolding the
area as before (AppHandle::bare_strip says which areas are bare). It
is the application’s choice, as AppBuilder::frameless is, not the
theme’s: whether a folded area lists its panels is part of how the
application is laid out, and the same theme serves applications with
and without the icons.
On a folded area, a click on an icon opens that panel alone as a
flyout over the centre, next to the strip, without moving the
layout (workbench.flyout, { "panel", "open" };
AppHandle::open_flyout). Escape or a click away closes it, the focus
going back where it was: it is an overlay of the stack
(egui_pop::core::overlay::hold), above which menus and dialogs open
as usual. A combo box’s list or a context menu opened in the panel is
part of the flyout: a click in it does not close the flyout, and Escape
closes it first. A click on another icon switches to that panel. A double
click on the icon, or the pin button in the flyout’s band, unfolds the
area with the panel shown. The flyout’s free edge resizes it; the
width is kept per panel and saved with the layout (flyouts,
workbench.flyout_size). Only a folded side area’s panels fly out;
unfolding the area closes the flyout. On an area lying over the
centre, open, a click on an icon shows its panel there.
A panel publishes an indicator through the status bar’s model,
speaking for it with Indicator::panel: while the panel is not shown
(its area folded, or another tab in front), its icon carries the state
as a micro-indicator: a count as a badge, else its errors or warnings,
else a dot in its tone, and detail joins the icon’s tooltip. Such an
indicator is not a status bar item.
use egui_pop::api::strips::{Indicator, Tone};
use egui_pop::model::ids::PanelId;
const SEARCH: PanelId = PanelId::from_static("app.search");
// Hits waiting in the search panel, on its icon while it is folded.
let hits = Indicator::new("search.hits", "No hits", "search.")
.panel(&SEARCH)
.reduce(|state, event| {
let n = event.data["hits"].as_u64().unwrap_or(0);
state.count = Some(n);
state.text = format!("{n} hits");
state.tone = if n == 0 { Tone::Neutral } else { Tone::Accent };
});
let _ = hits;
Agents read the strips in the workbench collector (strips: each
icon’s area, panel, title, icon, key, whether its panel shows, and its
indicator’s state with marked when the icon shows it; flyout: the
panel and its rect) or with workbench::strip; the mark itself is in
the indicators collector as strip:<indicator id>.
Plugins declare panels too: egui-pop’s jobs centre (egui_pop.jobs)
and devtools are panels like the application’s.
AppHandle::declared_panels lists every declared panel with the plugin
that declared it (its OwnerId), so a host that checks layouts or
templates against its own panels can accept those of the plugins it
connected, and a template may place the jobs centre.
Layers: what lies over what
The areas lying over the centre and the flyouts are foreground layers,
as overlays are. egui puts the one clicked last on top; egui-pop fixes
the order instead, in each window, bottom to top
(ADR 0026): the docked panels, the areas
lying over and the flyouts (Rank::Over), the overlays (Rank::Overlay:
toasts, the tips card, hover cards, popovers, the zen way out, an
application’s own), then the menus, combo lists and dialogs, and the
tooltips last. A click on a panel lying over no longer puts it over a
card.
An application’s own overlay, a card in a corner say, is shown through
layers::area at Rank::Overlay, instead of an egui::Area raised
with ctx.move_to_top each pass:
use egui_pop::egui;
use egui_pop::layers::{self, Rank};
fn did_you_know(ctx: &egui::Context) {
let card = egui::Area::new(egui::Id::unique("app.did_you_know"))
.anchor(egui::Align2::LEFT_BOTTOM, [12.0, -12.0])
.interactable(true);
layers::area(ctx, card, Rank::Overlay, |ui| {
ui.label("Did you know?");
});
}
let _ = did_you_know;
A layer drawn some other way (a layer_painter) calls
layers::rank(ctx, layer, Rank::Overlay) each pass it is shown, and
layers::rank_from ranks it only when the layer it opens from is not
above that rank, so a card opened from a dialog stays above the dialog.
A foreground layer nobody ranked stays above every ranked one; a host
drawing its own surface lying over the centre makes it a sublayer of
layers::base(ctx, Rank::Over).
A panel’s state
A panel whose content follows something it does not hold (the photo
selected, a document) may show content that no longer matches it. Whoever
knows says so on the bus, never the panel: pop.panel.state
(bus::PanelStateSet) with the panel’s id and its bus::PanelState:
| State | What the chrome shows |
|---|---|
Stale (no longer matches, its work not started) or Updating | the content dimmed and a busy mark on the panel’s corner and its tab, once the state has lasted motion.spinner.delay, then for at least motion.spinner.min: a fast update shows nothing |
Failed { reason } | the content dimmed and a failed mark at once, read “Update failed: reason” |
Ready | nothing |
use egui_pop::api::AppHandle;
use egui_pop::api::bus::{PanelState, PanelStateAsk};
fn photo_selected(app: &AppHandle) {
app.request_panel_state(PanelStateAsk::new("app.histogram", PanelState::Stale, "app"));
}
let _ = photo_selected;
The state may be asked from any thread, on the application’s bus too.
Stale then updating is one wait, its delay going on. A tab holds one mark
(bus::TabMark): when a panel has several, the highest rank wins, the
busy mark first. The marks are indicators named by bus::mark_id, for
tests and agents (indicator::find).
A panel’s kind
A panel says what it does to what the application edits (a document, a
photo), declared with it: PanelSpec::kind takes a
egui_pop_model::panels::PanelKind, a view unless declared.
| Kind | What it is | What the chrome shows |
|---|---|---|
View | it only shows, or moves what is shown (pan, zoom, selection) | nothing |
Control | its purpose is editing (parameters, a node graph) | an edits mark, read “Edits your work” |
Mixed | a view with parts that edit (a histogram dragged to change the exposure) | the edits mark, read “Parts of it edit your work” |
use egui_pop::model::ids::PanelId;
use egui_pop::model::panels::{Area, PanelKind, PanelSpec};
let spec = PanelSpec::new(PanelId::from_static("app.params"), "Parameters", Area::EndSide)
.kind(PanelKind::Control);
assert!(spec.kind.edits());
The mark is drawn by the chrome, never by the panel: on a docked tab’s
top end corner, and after the title of a floating palette’s band (or on
its tab in a group of tabs). It takes the tab’s one mark slot
(bus::TabMark::Edits), of the lowest rank: while the panel is busy or
failed (pop.panel.state), that mark shows instead, and the edits mark comes
back once it is ready. It is the same indicator id as the state’s
(bus::mark_id(panel, true)), its state edit.
pop.panel.open (bus::PanelOpen, AppHandle::open_panel) opens a
panel, whoever asks: its <panel>.toggle command, the
workbench.panel.open command (agents, menus), a tab group’s menu (Open
panel ▸, a right click on its bar’s empty part) and the “+” on each tab
bar (DockControls::add_buttons, off by default: the closed panels that
may open in that group). Its place is last (the default), here or
an area’s name. A closed panel’s place is kept when it closes
(Layout::last_place): last puts it back among the same tabs at its
index, floating at its corner or in its window; that place gone, it
joins the focused panel’s tab group when its areas allow it, else its
declared area. here opens it in the tab group holding group (any
panel of it, docked, floating or detached), else in the focused panel’s.
The workbench answers through the workbench.show step, so a plugin may
veto it.
Each window’s own workbench
Every application window (AppHandle::open_window) can hold panels in
areas of its own: a centre, start and end sides and a bottom, with tabs
and splits, around its content (Layout::windows, saved with the
layout; workbench::window_areas). A window with no panel in its areas
draws its content alone. Each area is a dock of the window’s own space:
its tabs reorder, split and move between the window’s areas by drag and
drop, and each tab’s menu is the panel menu.
A window opened with WindowSpec::centre_dock(true) has no content of
its own: its middle is its centre area, as the main window’s is. The
panels docked in its centre take the whole middle, between its sides and
above its bottom; empty, the centre says “Drop a panel here” and takes a
tab dropped there, from that window or another one. A home window for a
set of panels is opened this way. Without it, the window’s content keeps
the start of the middle and its centre’s panels go beside it.
pop.panel.open carries origin, the window it is asked from; menus,
commands and keys fill it in with the window they run in. A closed panel
opens by rule A:
- where the application sends it:
pop.panel.home(bus::PanelHome) answers a window’s id (its home window, say); a window not shown is passed over; - back to its last place, while that window is shown;
- in the window it was asked from, in its declared area;
- that window gone, in the main window while it shows the shell, else in the first window shown.
Never in a window closed, nor in the main window while another window’s
content holds it. An area named (place: "bottom") opens in the window
asked from too.
The area is the panel’s declared one, unless the application answers
pop.panel.home_area (bus::PanelHomeArea), asked after
pop.panel.home with the window the panel opens in: an area answered
replaces the declared one (in the main window too), where the declared
one would be used. A panel back to its last place stays there, an area
named by the ask wins, and an area the panel’s rules refuse is passed
over. An application answering only pop.panel.home keeps the declared
areas.
A window’s areas have the main window’s chrome:
- Folding.
AppHandle::fold_window_area(theworkbench.foldstep withwindow) folds a side area to a strip: a grip that unfolds it, then an icon per panel; the bottom folds out of sight. Folds are saved with the window’s areas (WindowAreas::folded); the centre never folds. - Flyouts. A click on a strip icon opens the panel alone over the
window’s content, next to its strip (
workbench.flyout, as in the main window); Escape or a press away closes it, its band’s pin unfolds the area. - Zen mode. Zen mode on one of the window’s panels
(
AppHandle::set_zen_panel) draws it alone in that window; the main window is left as it is. - F6. Each area is a region (
region.window.<area>), and the window’s content one more (region.window.content): F6 and Shift+F6 pressed in the window go through them in rank order (sides, bottom, centre), a panel of text alone holding the focus itself.
pop.panel.describe (bus::PanelDescribe, AppHandle::describe_panel)
describes a declared panel on the bus: its title, whether it is a
palette, and its kind (bus::PanelDescription), for agents and tests
without a screenshot.
Panel instances
A panel is declared once, and most open once (Settings, an import
window). A panel declared with several (PanelSpec::instances with
Instances::Multiple, or Ctx::instance_panel) opens as many times as
asked: a second gallery, another quick collection.
use egui_pop::api::Ctx;
use egui_pop::model::ids::PanelId;
use egui_pop::model::panels::{Area, PanelSpec};
fn connect(ctx: &mut Ctx<'_>) {
const GALLERY: PanelId = PanelId::from_static("app.gallery");
let _ = ctx.instance_panel(
PanelSpec::new(GALLERY, "Gallery", Area::Center),
|ui, app, instance| {
// One function draws every instance, told which it draws; what
// each shows is its payload, the application's.
let payload = app.instance_payload(&instance.id);
ui.label(format!("{}: {payload}", instance.title));
},
);
}
- Ids. The panel declared is instance 1. Each new one is
<kind>#<n>(app.gallery#2), still aPanelId: the dock, the focus, the fault boundary, the panel menu and the steps treat it as any panel.PanelId::kindandPanelId::instance_numberread it back. Its title is the kind’s with its number (“Gallery 2”). - Keys and undo. An instance has its kind’s: a binding with
when: "focusedPanelKind == 'app.gallery'"fires in each instance (a clause onfocusedPanelnames one panel), and a history scope whose focus target is the kind (ScopeInfo::focus) is active and takes Ctrl+Z in each instance (history). - Payload. Each instance holds a payload the application owns,
opaque JSON (
AppHandle::set_instance_payload,AppHandle::instance_payload). It is kept in the layout (Layout::instances), saved with it and handed back on restore. A layout saved before instances existed loads as one with none. - Opening.
pop.panel.opentakesinstance:"new"makes the next instance and opens it atplace(last: its kind’s area;here, an area), an instance’s id opens that one. A panel declared once refuses"new". Theworkbench.panel.opencommand passesinstanceon, and says the new id in its result, for agents. - Menus. A tab group’s Open panel ▸ and its “+” list “New
<panel>” first, for each panel declared with several that the group’s place allows. The View menu has the same entries, opening in the panel’s area; an application’s own Window menu adds them withMenuItem::listandpanel_menu::LIST_NEW_INSTANCES. - Closing. Closing an instance drops it with its payload: it is not kept closed, and its number may come back later. Closing the panel declared keeps its place, as any panel’s.
- Facts. The journal says
panel.instance.openedandpanel.instance.closed({ "panel": <id>, "kind": <kind> }), so the application can drop what it kept for a closed instance. Restoring a layout says the instances it opens. - Titles. An instance’s tab title is generated until the
application names it:
pop.panel.retitle(bus::PanelRetitle, abus::PanelRetitleAsk{ "panel", "title" }), orAppHandle::set_instance_titlefrom code. A library view opened on a collection reads “Picks”, not “Gallery 3”, and follows the collection when it is renamed. The title is kept in the instance’s layout entry (PanelInstance::title, next to its payload), saved and restored with the layout; a layout saved without titles loads unchanged. The tab, the panel menu’s list of instances, the View menu, accessibility and theInstance::titlehanded to the draw function all read it;title: nullgives the generated one back. Only an open instance<kind>#<n>takes a title: the panel declared, a panel declared once, an instance not open and a blank title are refused with the reason. The journal sayspanel.instance.retitled({ "panel", "kind", "title" },titlenullwhen the generated one is back). - Plugins. An instance whose kind’s plugin is off keeps its place and payload, as a dormant panel does (ADR 0028); declared again with one instance, the kind’s other instances are dropped.
Interactive areas
Inside a panel, each interactive area says what it writes, to the area
registry (egui_pop_core::areas), each pass it is drawn, after its
widget: a display area only shows (a scope’s picture), a
navigate area moves what is shown (pan, zoom, a scope’s mode), an
edit area writes what the application edits, with the control it
writes and its value now. The framework, never the widget, draws what
tells them apart:
- an edit area’s grips at rest (
areas::Grip), small handles where a drag takes it, as a Levels tool’s: a graph with grips edits, a graph without is a picture (the histogram’s exposure grip on its right edge; a waveform or a vectorscope has none); - the edit cursor of its drag (
AreaSpec::cursor); - a hover card naming the control and its value (“Exposure +0.30 EV”), also the area’s accessible description.
use egui_pop::core::areas::{self, AreaSpec, Grip};
use egui_pop::egui;
fn exposure(ui: &mut egui::Ui, ev: &mut f32) {
// Ask before sensing: inert while the panel is not current.
let sense = if areas::inert(ui) { egui::Sense::hover() } else { egui::Sense::drag() };
let (rect, r) = ui.allocate_exact_size(egui::vec2(160.0, 40.0), sense);
*ev += r.drag_delta().x / rect.width() * 4.0;
areas::register(
ui,
&r,
AreaSpec::edit("app.exposure", "Exposure")
.value(format!("{ev:+.2} EV"))
.path("exposure")
.grip(Grip::horizontal(rect.right_center())),
);
}
An edit area is inert while its panel’s state is not current
(pop.panel.state stale, updating or failed): the workbench draws the
panel’s content in an areas::scope that says so, and the area senses
no edit and shows no grip, no card, no edit cursor (the histogram of the
previous photo is not dragged). pop.ui.areas (bus::UiAreas,
AppHandle::ui_areas) lists the areas of each window’s last pass: id,
kind, control, value, path, rectangle, panel, grips, and whether it is
inert, for agents and tests without a screenshot.
Auxiliary windows
A detachable panel moves to an OS window of its own, with its own scale
and the application’s frame when it draws one
(AppHandle::detach_panel, attach_panel; the tab menu offers
Detach). Closing that window is the workbench.close_window step: its
default docks the panel back, a veto keeps the window open. Its place is
kept in the layout and repaired before the window opens. The window is
titled with the panel and the application’s name (AppBuilder::name,
“Filmstrip — Helios”), not the main window’s whole title.
Tabs in a detached window. Other panels may join a detached window as tabs: it shows them in one tab bar (no splits) and is titled after the tab shown. A panel joins it:
- by a drag: the window’s tabs are a dock of the workbench’s space,
one of egui_stack’s native floats (
FloatsArea, hosted by egui-pop with its own viewport ids), so a tab dragged from any window is one drag of the space (DockSpace::dragging). A detached window under the pointer shows the drop zone the areas show (the kit’sdock-preview), disabled with its reason for a panel that may not leave the main window (stack.dock.drop); let go there, the tab joins the window’s tabs. egui keeps each window’s input apart and the system hands a drag to the window it began in, so the window sees the pointer only through the space’s drag: a window embedded in the main one (kittest, a backend without windows) always does, an OS window does when both windows know where they are on the screen (X11, Windows, macOS). On Wayland, which hides window positions, each window that may take the tab outlines its dock once the tab leaves its window (DockPainter::window_outline, the kit’sdock-previewborder,AppHandle::window_outlines), and the window the pointer is over once the drag lets it go takes it; - from the tab’s menu, “Move to window”, which lists the detached
windows by their panels and works everywhere; an agent runs the
workbench.move_to_windowcommand (panel, the focused one by default;window, a panel of that window),AppHandle::move_to_windowfrom code.
Each way is one workbench.join_window step (panel, window): a
drop egui_stack lands in a detached window is put back and moved by
that step, which a plugin may veto (the tab stays where it was). Its
tab’s menu moves a panel out again (“Move to …” docks it, Detach gives
it a window of its own); closing the window docks every panel it holds.
The layout document keeps the first panel under panel and the others
under tabs, the shown one as shown: an application that predates
tabs in windows opens the first panel there and docks the others in
their default areas.
A whole tab group. The empty part of a tab bar, right of its tabs,
the grip at the end of the bar, or a tab dragged with the group key
held (Shift by default) drags the whole group, as an editor group is
dragged by its tab bar in established IDEs. Each of these handles is a
setting the user turns off (workbench.group_handle.empty_space,
.grip, .modifier_drag, .menu; the key is
workbench.group_drag_modifier: shift, ctrl or alt), among those the
application allows (AppBuilder::group_handles, all of them by
default). The tab menu’s “Move group” (GroupHandles::MENU) lists a
new window and the other areas, each by its title and the titles of
the panels it holds (“Start side bar (Tree)”), translated. A floating window’s move handle
(workbench.group_handle.move_window) and what moving the window does
(workbench.float_move: move, the default, or dock) are settings
too, for egui_stack’s floats. Dragged whole, all its tabs move together, in order, the shown one
kept (egui_stack’s DockArea::dragged_node). Inside the main window it
takes the same zones as a tab (the middle of a group joins its tabs, an
edge splits the group), each tab dropped in another area running its
workbench.move; over a detached window it joins the window’s tabs
whole, with the same frames and outlines as a tab (the drag session
carries the group); let go outside every window, it opens a window of
its own holding it. A group goes whole or not at all: the first of its
panels that may not leave the main window refuses it, with its reason.
The tab’s menu offers the same, “Move group to window”, naming each
detached window and a new one, for keyboard users and where a drag
cannot reach a window (Wayland), on a group of two tabs or more. Across
windows, these are the workbench.join_window and workbench.detach
steps with group: true (Change::JoinWindowGroup,
Change::DetachGroup): the window it opens is its pop.window.open, a
window it empties closes as a panel’s joining another does.
Back out of a detached window. A detached window always shows its
tab bar, even holding one panel. A tab dragged out of it and let go
over another window of the application goes there: over the main
window, it docks in the area under the pointer (the centre, a side or
the bottom area drawn, or a closed one along the areas’ edge), as a
workbench.move step; over another detached window, it joins its tabs.
Over the main window the areas show the zones of a drag begun there
(a group’s middle, its edges, a tab bar, a closed area along the
areas’ edge), disabled with its reason where the area refuses the
panel (only_in); a drop there is refused with that reason
(drag.refused, workbench.refused), the tab staying in its window,
and a drop it takes is said as dropped on workbench.area.<area>.
Let go outside every window, nothing moves. Where the system tells
where windows are (X11, Windows), the zone shows during the drag; on
Wayland, which hides window positions, the main window’s docks are
outlined instead, and the drop goes to the window the pointer is over
once the drag lets it go; the way home that
always works is the Dock back button at the end of the window’s
tab bar, the tab menu’s Dock back, or Ctrl+Shift+D
(workbench.panel.dock_back, on the focused panel): the shown panel
docks back where it came from, else in its own area
(workbench.dock_back).
Such a window is a window of the application in full:
- Keys. The keymap reaches it: the key dispatcher runs in each
window’s pass, in that window’s context. Its focus chain is its own
(egui keeps a focus per window), so an editor’s find or save fires in
the window where the editor has the keyboard, and the
windowcontext key holds the detached panel’s id there (empty in the main window):when: "window == 'app.log'"binds a key in that window only. - Dialogs. A dialog comes up over the window the user worked in
last (
AppHandle::active_window: focused, clicked or typed in), so a dialog opened from a detached panel’s window is shown there. While it is open, every other window is blocked: its keys are dropped and a backdrop covers it; a click there brings the dialog’s window to the front. A window closed with a dialog open gives it to the main window. Each window has its own overlay stack (egui_pop_core::overlay); blocks of theWINDOW_OVERLAYSzone are drawn in every window, each drawing what belongs to it. - Menus, the palette and toasts. As in VS Code’s auxiliary windows,
they open in the window in use: the command palette and a popup menu
(
menus::popup_at) open over the window the user worked in when they opened, and a context menu over the widget it belongs to; the toasts show in the active window. Each goes to the main window when its window closes. The palette, a modal overlay, blocks the other windows as a dialog does. The settings window and the in-app file chooser open in the main window.
The bottom panel lies under the editors by default, between the side
bars, which go down to the bottom, as VS Code has it. The
workbench.panel_alignment setting lines it up otherwise, as VS Code’s
panel alignment does: justify (the window’s whole width, under both
side bars), start (under the start side bar) or end (under the end
one); AppBuilder::panel_alignment gives the default.
The menu bar
The shell draws the main menu (app.main) as a menu bar. When the
window is too narrow for all of it, the menus that fit stay in the bar,
from the start, and the rest become submenus of a “…” entry (the
more icon, named “More menus”), keeping their titles, items and
when clauses. When no menu fits besides “…”, the whole menu is one
entry (the menu icon, named “Main menu”). The blocks of the
app.top-bar zone keep the width they took, after the menus. At the
bar’s end, the commands of MENU_BAR_END show as icon buttons, and the
blocks of the app.top-bar-end zone (zones::TOP_BAR_END) before them,
left to right: a document’s name, a readout, any widget of the
application’s. They too keep the width they took; the menus overflow
first. Without the menu bar (AppBuilder::menu_bar(false)), the top bar
still shows when either zone has blocks. Each
label is measured once, and again only when the language, the kit or
the scale changes.
Each menu has an access key: the first letter of its label not taken by a menu before it (File, Edit, View, Help: F, E, V, H). Alt and that letter open the menu, in the bar or inside “…” with the menu’s submenu open; a key binding on the same keys wins. The accessibility tree gives each menu its access key.
menus::bar_layout(app, &MENU_MAIN) says where each menu went last,
and the menu_bar debug collector shows it: bar, overflow,
collapsed and keys. menus::bar_within draws any declared menu as
such a bar, keeping room at its end.
Zen mode
workbench.zen (View > Zen mode) toggles a view of the panel that
matters alone, full size: the title bar, the menu and status bars, the
activity bar, every other panel and the floating palettes are hidden,
and the frame publishes no caption. Which panel, in this order:
- the one named:
panelin the command’s arguments, which the panel menu’s “Zen this panel” passes (a tab’s, a floating panel’s); - the focused panel, when it is a view or a mixed one
(
PanelSpec::kind; zen on a control panel makes no sense); - the application’s choice, asked on the bus as
pop.zen.panel(bus::ZenPanel, an alter point egui-pop does not answer itself): an image viewer answers with the surface a double click reaches; - the centre’s active tab;
and with none of them open, the centre whole. The centre’s only panel
is shown as the centre whole: drawn where it was, the widget holding
the keyboard keeps it. AppHandle::zen_target
says which it would be, AppHandle::set_zen_panel zens a panel,
AppHandle::zen_panel says which one is shown. A panel in a detached
window is zenned in that window: the window draws it alone, without its
title bar and tabs, and the main window stays as it is. Zen mode only
changes what is drawn, never the layout: leaving it draws the layout as
it was. Shift+F11 toggles it (Sublime Text’s
distraction free mode; VS Code’s Ctrl+K Z is left out, since it would
make Ctrl+K a prefix everywhere while it deletes to the line’s end in
a text field). An application binds its own key in its defaults, and
takes the default away below them:
ctx.keybinding("Ctrl+K Z", workbench::CMD_ZEN, "", Layer::Default)?
.unbind("Shift+F11", Layer::Workspace)?;
Escape leaves it (workbench.leave_zen, while no
overlay is open, no mode is pushed and no text field has the
keyboard; in a text field, the first Escape leaves the field and the
second leaves zen mode). The way out stays in sight: on entering, a
strip at the top centre (the kit’s fullscreen-exit component) says
“Zen mode: Escape to leave” (the key bound to workbench.leave_zen)
next to a “Leave zen mode” button, for three
seconds, then fades over motion.duration (at once under reduced
motion); screen readers hear it once. Afterwards, the pointer at the top
edge brings the strip back, as the menu bar of a full screen window on
macOS, until it leaves the strip. The command palette (Ctrl+Shift+P)
still opens in zen mode and offers “Leave zen mode”. In full screen,
zen’s strip stands in for full screen’s own. The change is the
workbench.zen step ({ "zen": bool, "panel"? }, its result naming the
panel and its window,
AppHandle::set_zen, AppHandle::zen, the workbenchZen context
key): a plugin may veto it, and the journal records it. Zen mode is a
state of the session, not of the layout: it is never saved, and the
next start shows the whole workbench. Combined with full screen, it
leaves the content alone on the screen.
The layout controls
VS Code’s layout controls, the rule here (egui_pop::api::layout_controls):
-
The area toggles.
workbench.toggle.primarySideBar(Ctrl+B),workbench.toggle.panel(Ctrl+J) andworkbench.toggle.secondarySideBar(Ctrl+Alt+B) fold a shown area to its strip, or show it again, through theworkbench.foldstep: the area keeps its panels, its tabs and its size. An area with nothing left to show gets its first closed panel back (workbench.show). The primary side bar is the start side area, the panel the bottom one, the secondary side bar the end side one. They are in the View menu, ticked while their area shows; the context keyssideBarVisible,panelVisibleandauxiliaryBarVisiblesay so. The strips plugin’s own fold command (view.side_bar.toggle) has no key:Ctrl+Bis VS Code’s. -
The options, settings each change of which is one undo step: the primary side bar on the left or the right (
workbench.side_bar_position,leftby default; the secondary one lies across from it, the activity bar beside the primary one; theworkbench.layout.sideBarPositioncommand), and the bottom panel under the editors or across the full width (workbench.panel_alignment,centerby default as VS Code’s; theworkbench.layout.panelAlignmentcommand). -
The layout menu (
layout_controls::MENU_LAYOUT, View > Customize layout, theworkbench.layout.customizecommand): the area toggles; the arrangements, the application’s templates and the saved ones, the current one ticked; “Save the current arrangement as…”, which asks for a name in a dialog; and the options. -
In the title bar, when the application asks for them:
App::builder().plugin(FramePlugin::own().layout_controls(true))A “Customize layout” button opening that menu, then a toggle per area, at the end of the bar before the window’s buttons (the
egui_pop.frame.layoutblock of theapp.captionzone). Each toggle’s icon is filled while its area shows and outlined while it is folded or hidden (layout-left,layout-bottom,layout-rightand their-offtwins); its tooltip gives its key, and assistive technology hears it as a toggle. They are drawn by the kit’sicon-button.layout_controls::showdraws the same controls anywhere else (the gallery’s Layout controls page). -
The side bars’ icons follow their side, as VS Code’s: with the primary side bar on the right, its toggle shows
layout-rightand the secondary side bar’slayout-left, and the title bar’s toggles read secondary, panel, primary from the start. The layout menu, the View menu and the palette mirror the toggle commands’ icons the same way (layout_controls::command_icon); the menus keep their order, as VS Code’s layout menu does, and the commands and their keys stay the same. The title bar’s icons are listed by the debug bridge’siconscollector (thelayout controlssurface), the menus’ rows bymenus::rows_drawn.
Palettes and toolboxes: never modal
Decided on 2026-10-13: a toolbox, a colour palette or a navigator
floating over the canvas is non-modal, always. It never blocks the
interface, never takes the keyboard unless clicked into, and gives the
keyboard back on Escape. Anything that must block until it is answered
is a dialog (egui_pop::api::dialogs, movable when it hides what it
acts on), never a palette.
One model, two placements. A palette is a panel declared with
PanelSpec::palette(): it opens floating over the workbench, and its
area is where it docks. Every other panel may float too, unless its
spec opts out (floatable(false): a view that would leave its area
empty, such as the centre’s document). The user’s “Floating panels”
setting (workbench.float_panels) narrows that to the palettes
(palettes) or leaves it (any, the default); it never widens what a
spec allows. The layout keeps floating panels next to the docked and detached
ones (Layout::floating: place, size, rolled up, pinned), saved and repaired
with them.
use egui_pop::egui;
use egui_pop::model::ids::PanelId;
use egui_pop::model::panels::{Area, PanelSpec};
use egui_pop::prelude::*;
const TOOLS: PanelId = PanelId::from_static("demo.tools");
struct Demo;
impl Plugin for Demo {
fn id(&self) -> PluginId {
PluginId::from_static("demo")
}
fn connect(&mut self, ctx: &mut Ctx<'_>) -> Result<(), PluginError> {
// Floats when it opens; docks in the start side bar.
ctx.panel(
PanelSpec::new(TOOLS, "Tools", Area::StartSide).palette(),
|ui, _| {
ui.label("Brush");
},
)?;
Ok(())
}
}
let app = App::builder().plugin(Demo).build(&egui::Context::default()).unwrap();
assert!(app.handle().layout().floating_of(&TOOLS).is_some());
- The band. A palette has the movable dialogs’ header band
(
egui_pop_core::band, the kit’sheader-bandandband-icon-button): its title, then Pin, Roll up and Close. Rolled up, only the band is left (a double click on the band does it too). Pinned, it stays where it is, in sight and opaque. - Dragging. The band drags the palette, kept inside the workbench
(again when the window is resized) and snapping to the workbench’s
edges and to the other palettes within the
palette.magnettoken. Dropped on a side bar or the bottom panel (or a closed one’s edge) with the dock keys held, with the drop hint the tabs use, it docks there. A docked panel floats from its tab menu (Float); where it may not, Float is greyed and says why (“Float (Document cannot float)”, “Float (only palettes float)”). Float group, in the tab menu and the group menu (the empty part of the tab bar, its grip), floats the docked tab group whole as one floating group of tabs, in order, its shown tab shown (workbench.panel.floatwithgroup); Dock back on any of its tabs puts the whole group back where it was. Float group is offered while the tab menu’s group entries are allowed (theMENUgroup handle and its setting). - Moving or docking (decided on 2026-11-17,
design). A plain drag of a floating
palette (its band, a member’s band, a floating tab) only moves it:
the drop targets (an area, another palette’s group) show and take it
only while the dock keys are held, the
gesture.workbench.dockgesture (Ctrl+PrimaryDrag, Cmd on macOS, in every shipped pointer profile, rebindable in the shortcuts editor). The keys are read every pass of the drag: pressed or let go mid-drag, the targets show or go. Snapping and anchoring stay on a plain drag. The mode is theinput.dock_dragsetting (said once aspop.settings.changed):modifier-docks(the default),modifier-floats(a plain drag docks, the keys keep it floating: Photoshop’s and Visual Studio’s way, the Photoshop pointer profile’s),dwell(docking arms once the pointer rests on a target forpalettes::DWELL, half a second: for touch and pen), orprofile(the pointer profile’s, itsoptions.dock_drag); an application picks the default withAppBuilder::dock_drag. While a palette is dragged over a target, a one-line hint says how to dock or not, worded after the mode and the keys bound (“Hold Ctrl to dock”, “Release Ctrl to move only”, “Hold Ctrl to move without docking”, “Rest here to dock”): in the status bar, or under the pointer without one (palettes::drag_hint).palettes::GroupHint::armedandDropHint::armedsay whether a drop now docks or joins; only armed targets are drawn. The panel menu of a floating palette (a right click on its title) docks it too: Dock in the start side bar, the end side bar or the bottom panel, for a pointer with no keyboard. - Sticky edges. Dropped on an edge of the workbench (snapped onto it
or kept against it), a palette is anchored there:
FloatingGroup::anchorholds, on each axis, the start edge, the end edge or none, and the distance to it. When the window is resized, or a saved layout is restored at another size, an anchored edge keeps its distance, so a palette on the right edge follows it; the other axis keeps its place. Dragged away from the edge, it is no longer anchored. A palette off the edges, or snapped to another palette only, is just kept inside. The anchor is saved with the layout (layouts saved before it load unanchored);palettes::anchor_ofandpalettes::anchored_poscompute it. - Groups. Palettes float in groups (
Layout::floatingholdsFloatingGroups; a palette alone is a group of one). A palette dropped on another one’s top or bottom quarter (palettes::join_at, with the drop hint the tabs use) stacks above or below it: a column where each member keeps its own band, its own roll-up (a column of rolled-up toolboxes) and its Close. The group’s band, over its members’, lists their titles: it drags the group as one unit, pins it and anchors it as a single palette. Dropped on a side bar or the bottom panel, it docks every member there, as tabs; floating one of them again (Float) gives the whole group back, from the members still docked beside it (Layout::docked_groups). A member’s own band drags it out of its group (dropped back over its group, it stays), or onto another palette’s edge into that group. Dropped on the middle of another palette, a palette joins its group as a tab: the group’s band holds the tabs (a click shows one), the shown member keeps its own band, which drags it out. Thepalette.group.gaptoken is the room between stacked members. A group is saved as the floating panel it was before groups, its other members undergroup: an application that predates groups floats them apart. - Docking conventions. Groups follow the classic docking
conventions (Photoshop, Krita, GIMP, Qt docks, VS Code), decided on
2026-10-21:
- Close group is an entry of the menu on the group’s band (its
…button), never a button on the band, so that a stray click cannot close a group. It runspalette.close_group, which a hook may veto. - A tab dragged out of its tabs comes out of them
(
palette.ungroup): alone where it is dropped, or into the palette or group it is dropped on, following the usual drop rules (an edge stacks, the middle adds a tab, an area docks it). Dropped back on its own tabs, it stays. The member’s band still drags it too. - Closing the shown tab shows its neighbour on the right, or the one on its left when it was the last (Qt’s default, as in browsers).
- An edge drop on a group of tabs stacks the palette above or below
it, and the tabs stay tabs: a stack’s member may be a tab group
(
Member::tabs), one level deep, never a stack in tabs. Its band holds its tabs, the shown tab’s Close and the tab group’s Roll; the band drags the tab group out of the stack whole (palette.ungroupwithtabs: true). A middle drop on a member of a stack makes that member alone a tab group, the rest of the stack staying a stack. A group docked whole (palette.dockwithgroup: true) and floated back comes back nested as it was. - Layouts. A nested tab group is saved as its first tab, its other
tabs under
tabsand the shown one asshown: layouts saved before load unchanged, and an application that predates nesting reads the first tab as a plain member of the stack and puts the other tabs back as it does any panel missing from a layout (a palette floats again on its own, a panel opening closed stays closed).
- Close group is an entry of the menu on the group’s band (its
- Sizes. A palette is sized by its content until it is resized:
each of its four edges and four corners (the
palette.griptoken’s width, each with the cursor of its direction) drag its size, a left or top edge keeping the opposite edge where it is (the steppalette.resizethen carries the new place,pos), kept between thepalette.min-widthandpalette.max-widthtokens (never narrower than its panels’ least width),palette.min-heightandpalette.max-height, and inside the workbench. Its content scrolls when it is taller than the room left; rolled up, it keeps its width. The size is the group’s (FloatingGroup::size, saved with the layout; layouts saved before it load sized by their content): palettes joining a group take its size, a palette coming out of it is sized by its content again. Resized against an edge of the workbench, it is anchored there; pulled away from it, it no longer is. A double click on an edge gives it its content’s size back, andpalettes.resetdoes for every palette. - Tab (
palettes.toggle, rebindable) hides and shows the unpinned palettes. It is the toggle only while some panel floats, no widget has the keyboard and no overlay is open; otherwise Tab moves the keyboard to the next widget, as always. - Strokes and the pointer.
palettes::set_stroke(app, true)says a stroke is in progress: with thepalettes.fade_on_strokesetting on, the palettes fade until it ends.palettes.idle_opacitymakes them translucent while the pointer is elsewhere. - Reset.
palettes.resetputs them back where they first open, rolled down, sized by their content and shown. - Steps (ADR 0011):
palette.open,palette.float,palette.dock,palette.move(once a drag is dropped: a veto puts the palette back, a redirect places it elsewhere),palette.resize({panel, size}, once an edge is dropped;size: nullfor the content’s size; a veto gives it its size back),palette.roll,palette.pin,palette.group({panels, into, at},atbeingabove,belowortab),palette.ungroup({panel, pos},tabs: truefor a nested tab group whole) andpalette.close_group({panel}); a group docks whole throughpalette.dockwithgroup: true. Once done, the journal sayspalette.opened,palette.floated,palette.docked,palette.moved,palette.resized,palette.rolled,palette.pinned,palette.grouped,palette.ungroupedorpalette.group_closed.
Not built yet: a palette outside the main window, as a native utility window. egui’s viewports have no owner window (only “always on top” of every application), so such a window would float above other applications too.
Where the layout is kept
With a persistence directory (AppBuilder::persist), the layout is
loaded at the start and saved by App::save (so at exit) in the
document the host names, Host::layout_document: layout by default,
a workspace’s own (workspaces/photos/layout, asked again at each load
and save), or None for a host keeping the layout itself through
AppHandle::layout and set_layout (LocalHost::with_layout_document
opts out the same way). An application switching workspaces calls
App::load_layout once its host names the new one. Both are steps,
layout.load and layout.save ({ "document" }): a plugin may
redirect the document, veto, or load and save elsewhere.
Arrangements
Named layouts saved, switched and reset, kept in the host’s store
(egui_pop::api::arrangements, in DefaultPlugins). A plugin offers
templates (Ctx::arrangement); resetting goes back to the current
arrangement’s template. The Default arrangement’s template is the
starting layout (AppBuilder::layout), or every panel in its default
area. Steps: arrangement.save, arrangement.switch,
arrangement.reset, arrangement.delete.
Slim strips
StripsPlugin (opt-in) draws the activity bar, a button per panel of the
start side bar (Ctrl+B, the workbench’s workbench.toggle.primarySideBar,
folds the side bar to its strip), and status bar
indicators fed by the host’s journal: an Indicator is a reducer over
the events of a prefix, so a long job publishes its progress and the
status bar follows it.
The activity bar and the status bar are each one Tab stop (a roving group): Up and Down go between the activity bar’s buttons, Left and Right between the status bar’s items, and Tab coming back lands on the one focused there last.
use egui_pop::api::strips::{Indicator, Tone};
let jobs = Indicator::new("jobs", "Idle", "job.").reduce(|state, event| {
let n = state.count.unwrap_or(0);
state.count = Some(match event.name.as_str() {
"job.started" => n + 1,
"job.done" => n.saturating_sub(1),
_ => n,
});
state.tone = if state.count == Some(0) { Tone::Neutral } else { Tone::Accent };
});
let _ = jobs;
An indicator can follow the context stack (contexts):
when("place == 'photos.album'") shows it only where the clause holds,
with the grammar of commands over the context keys (place,
placeDepth, modePushed, mode.<group>, a frame’s own keys);
during(&frame) writes a frame’s clause for it. Hidden, it keeps
reducing events, so its state is right the moment it shows again. A
clause that does not parse keeps it hidden and is a diagnostic
(indicator-when).
With the context stack installed too, the status bar starts with where
the user is and what is active (status and context):
the breadcrumb (a click on a crumb goes back to that place, the current
one does nothing), then a chip per active mode whose group is declared
visible (FrameSpec::visible, its tone FrameSpec::tone). A click on a
chip leaves its mode; a pushed mode shows a back mark and goes back to
what it replaced; a mode whose guard refuses keeps its chip and says why
in its tooltip. On a narrow window the middle crumbs collapse into …
(a menu of them) first, then indicators give way (the lowest
priority first, then the heaviest) into the bar’s … menu; chips
never hide. StripsPlugin::breadcrumb(false) keeps the bar to its
indicators, for an application showing the breadcrumb elsewhere
(contexts::breadcrumb, contexts::mode_chips); contexts::crumbs,
contexts::chips and contexts::why_not give what they show.
The user hides status items and orders them from an item’s context
menu (only status items can be muted); agents use status.item.hide
({ "id", "hidden" }) and status.item.move ({ "id", "toward": "start" | "end" }), code strips::hide and strips::move_item. The
choices (strips::choices) are kept per place of the context stack in
its view document (contexts::place_value, set_place_value), so a
bar arranged for the darkroom comes back as it was; a place without
choices of its own takes the root’s. Without the context stack they
last the session.
Items sit at the bar’s start or end (align), show busy, error and
warning states, and may open a popover or a rich hover card: see
the status bar.
Agents read what the user sees: context.read gives the visible status
items in its status field (each one’s id, text, tone, count,
progress, and the states of the status bar), and the strips debug collector shows the breadcrumb,
the chips, every item with why it is hidden (hidden_by: the when
clause that does not hold, user, or narrow) and the choices of the
place shown; in code, strips::status and strips::visible.
The window’s own frame
FramePlugin (opt-in) draws the title bar in the TITLE zone above the
menu bar, and the window’s resize edges, never thinner than 6 physical
pixels; a setting gives the system’s frame back. The frame publishes
each window’s hit regions in physical pixels (egui_pop::core::frame,
HitTable, HitRegions::hit), what a platform layer needs to answer
the system’s hit tests itself. Steps: frame.minimize,
frame.maximize, frame.close, frame.system_menu,
frame.exit_fullscreen, frame.hit_test.
The bar starts with the CAPTION_START zone, whose default block
(frame::BLOCK_MENU, egui_pop.frame.menu) is the system menu button
and the application’s name; an application puts its logo there by
replacing that block, and keeps the menu with frame::menu_button. The
bar itself (frame::BLOCK_TITLE) keeps following the setting. The
CAPTION zone holds the application’s buttons, before the window’s;
FramePlugin::layout_controls(true) puts VS Code’s layout controls
there, nearest the window’s buttons (see “The layout controls”).
In full screen (F11) the bar stays, with both zones: an
application keeps its menus, status items and logo there. Only what a
window needs goes: minimize, the resize edges (the hit table publishes
no edge), and moving the window by its bar. Close stays, and a button
leaving full screen takes maximize’s place (the
window-exit-fullscreen glyph role, the frame.exit_fullscreen
step). A double click on the bar does nothing in full screen: it would
otherwise maximize, which full screen has no use for, and leaving full
screen on a double click aimed at an item of the bar would surprise
more than it helps; the way out is that button, or F11. The
window.bar_in_fullscreen setting (on by default) gives the former
behaviour back: off, the bar is not drawn in full screen and publishes
no caption, and the strip at the top edge (WindowPlugin) is the way
out.
use egui_pop::api::frame;
use egui_pop::prelude::*;
fn connect(ctx: &mut Ctx<'_>) {
ctx.block(
zones::CAPTION_START,
Block::replace(frame::BLOCK_MENU, BlockId::from_static("app.logo"), |ui, app| {
frame::menu_button(ui, app);
ui.strong_text("My app");
}),
);
}
Windows: Snap Layouts and Aero Snap
On Windows, when the application draws the frame, FramePlugin
subclasses the main window (the egui-pop-win32 crate) and answers the
system’s hit test from the published regions: the caption moves the
window natively (Aero Snap, shake), the maximize button shows Snap
Layouts, the edges resize. Clicks on the buttons and a double or right
click on the caption still come back as the frame’s requests, so their
steps run. In full screen the caption is answered as client area (the
system must not move the window) and so is the button leaving full
screen, which is no maximize button: Snap Layouts never show in full
screen. The window’s handle comes from eframe when the application
starts with run_native (or run_native_with); an application starting
eframe itself passes it with frame::set_native_window. Elsewhere,
nothing is installed. A plugin may keep the system’s hit testing:
use egui_pop::api::frame::{FramePlugin, STEP_HIT_TEST};
use egui_pop::core::frame::{FrameLayout, Hit, HitRegions};
use egui_pop::egui;
use egui_pop::prelude::*;
struct KeepSystemHitTest;
impl Plugin for KeepSystemHitTest {
fn id(&self) -> PluginId {
PluginId::from_static("keep_hit_test")
}
fn connect(&mut self, ctx: &mut Ctx<'_>) -> Result<(), PluginError> {
ctx.before(STEP_HIT_TEST, |_, args| {
if args["install"] == true { Before::Veto("ours".into()) } else { Before::Go }
});
Ok(())
}
}
let app = App::builder()
.plugin(FramePlugin::own())
.plugin(KeepSystemHitTest)
.build(&egui::Context::default())
.unwrap();
assert!(app.handle().diagnostics().is_empty());
// What the layer answers is what the regions say (physical pixels).
let bar = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 32.0));
let layout = FrameLayout {
window: egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0)),
caption: Some(bar),
maximize: Some(egui::Rect::from_min_size(egui::pos2(712.0, 0.0), egui::vec2(44.0, 32.0))),
grip: 4.0,
resizable: true,
..FrameLayout::default()
};
let regions = HitRegions::measure(&layout, 2.0);
assert_eq!(regions.hit(1468, 30), Hit::Maximize);
assert_eq!(regions.hit(800, 30), Hit::Caption);
Scale
Each window has its own scale: egui_pop::core::scale gives it
(Scale::of), snaps stroke widths to whole pixels (stroke,
hairline) and says once when it changes (changed; scale.changed on
the journal). The interface zoom is egui-pop’s (egui_pop::api::zoom): a
setting in fixed steps, Ctrl+Alt+=, Ctrl+Alt+- and Ctrl+Alt+0
(rebindable), the interface.zoom step; egui’s own zoom keys are off.
The keymap at run time
A host whose registry changes declares commands after build
(AppHandle::declare, undeclare): menus, the palette and the keymap
follow. A profile is a whole keymap document: export_keymap(layer) and
load_keymap(doc, layer) keep scopes, when clauses and every key, and
report what changed (KeymapDiff). Rebinding is the keys.rebind step,
loading keys.load; each new conflict is a keys.conflict signal.
Keys change in the user’s layer (rebind, reset_keys, saved with the
interface’s settings) or in the workspace’s (rebind_in,
reset_keys_in with Layer::Workspace), which the application keeps
and reads back with export_keymap. The shortcuts editor offers the
choice once the application asks (offer_workspace_keys), the user’s
by default, and says after each key where it comes from
(key_sources): workspace or user, nothing for a default, or the
application’s own name for it (name_key_sources). Two
bindings of one key whose when clauses can never both hold
(view == 'masks' and view == 'lighttable', When::excludes) are no
conflict.
Pointer gestures live in the same keymap (Ctrl+Wheel, MiddleDrag
bound to gesture commands in a canvas’s scope), the pointer profile’s
in the default layer; rebind_gestures gives a gesture several
triggers at once. See Pointer gestures and profiles.
Around the shell
AppBuilder::wrap draws around the whole application,
main_edge_to_edge drops the centre’s margins, frameless an area’s
margins and its panels’ frames, layout gives the starting layout,
on_exit runs before the
app.exit step (whose default saves), run_native_with hands the built
application to an eframe::App of the application’s own (its make
returns a Result: an error is logged, published as app.make_failed
and returned by eframe), and
window::restore gives NativeOptions the window’s kept place.