Skip to main content

Module workbench

Module workbench 

Source
Expand description

The workbench: panels in areas (the centre, the start and end side bars, the bottom panel), as tabs and splits drawn by egui_stack. The versioned layout document (egui_pop_model::layout::Layout) is the saved form; the areas are the named docks of one egui_stack::DockSpace, which is how they are drawn and rearranged by hand, and which is read back into the layout as needed.

Experimental: may change in any release (docs/stability.md).

The workbench lays the areas out (a side area’s width, its fold and flyout, the bottom panel’s alignment) and draws each area’s dock where it put the area; the docks share one drag, so a tab dragged from one area to another gets the same drop zones as inside one (the middle of a group joins its tabs, its edges split it, a tab bar takes it between two tabs), with the same preview.

Placement rules come from each panel’s declaration (PanelSpec): the areas it may be in (only_in), its smallest size across its area (min_size) and the size it asks for (default_size). A tab dragged onto an area its rules keep it out of is refused there: the drop zone shows it disabled, with the reason. A tab dropped in another area is moved through the workbench.move step, which a plugin may veto (the tab goes back where it was) or redirect (ADR 0003).

The shell’s zones are placed in areas as panels: app.side-bar (the SIDE_BAR zone, start side), app.main (MAIN, centre) and app.inspector (INSPECTOR, end side); a zone panel with no blocks is not drawn, and one alone in its area is drawn without a tab bar.

The layout changes only through named steps (ADR 0011), each with its default, a plugin may veto, redirect or replace them:

StepArguments
workbench.move{ "panel", "area" } (center, start_side, end_side, bottom), window for an application window’s area; also run once a tab is dropped in another area, of any window
workbench.show{ "panel" }: docks it back (its default area) and shows its tab
workbench.hide{ "panel" }: closes it (kept closed by the layout)
workbench.focus{ "panel" }: shows it and gives it the keyboard: see the focused panel
workbench.fold{ "area", "folded" }: an area folded to its strip, or unfolded
workbench.place{ "area", "placement" }: a side area lies beside the centre or over it
workbench.flyout{ "panel", "open" }: a folded side area’s panel opens alone over the centre, or closes
workbench.flyout_size{ "panel", "width" }: the width of a panel’s flyout, saved with the layout
workbench.detach{ "panel" }: into a window of its own (its own scale)
workbench.attach{ "panel" }: a detached panel docked back
workbench.close_window{ "panel" }: a detached panel’s window closes; the default docks it back, a veto keeps the window
workbench.join_group{ "panel", "group" }: docks it in the tab group holding group, after its tabs, shown
workbench.dock_back{ "panel" }: a floating or detached panel docked back where it floated from, else in its own area
workbench.zen{ "zen" }: zen mode on or off (see below)

A panel’s context menu is the same wherever it is, docked, floating or detached: panel_menu.

§The focused panel

AppHandle::focused_panel, the context key focusedPanel, is the panel the keys obey. It follows the widget focus, however that arrived:

  • Tab or any widget taking the focus: its panel, the one it was drawn in, is the focused panel.
  • workbench.focus and <panel>.focus: the panel is focused at once and takes the widget focus in the next pass: the widget named by focus::prefer in it (a canvas under a toolbar, a search field), else the panel itself, a stop of its own, named after it and there only while it holds the focus, from which Tab enters its widgets. Never its first focusable widget unasked: a slider focused that way would take the wheel meant to scroll the panel. It stays where it is if the focus already is in the panel. Behind a modal, or when an agent’s command finds someone typing, only the logical focus moves.
  • A press in a panel, whether or not a widget takes the focus.
  • The focus leaving for something no panel holds (the menu, the status bar, a tab of a dock, nothing): the last panel stays focused until another takes it, so a menu’s command acts on the panel it was opened from.
  • A floating palette or a flyout only borrows it: a press in it moves nothing, a widget of it taking the focus does, and when that lets go (Escape, a click elsewhere, the palette closing) the keys go back to the panel of the layout that had them. So a click on a palette’s background leaves the keys on the image, as in an image editor.
  • A detached window counts when its widget takes the focus or the pointer presses in it, and the main window when it gets the system’s focus back. Each window keeps its own widget focus (egui does).

Following is a plain write, not a step, so it cannot loop back into workbench.focus; each change is published once as workbench.focused.

§Moving between regions

workbench.next_region (F6) and workbench.previous_region (Shift+F6) move the keyboard through the window’s regions: the activity bar, the start side area, the end side area, the bottom area, the centre, each palette drawn, an open flyout, the status bar. Each landing follows egui_pop_core::regions: an area without anything to focus in its panel takes it as workbench.focus does, on the panel’s own stop. A menu or a popover open (not a flyout) keeps the focus, for Escape first, and so does a modal; so does someone typing when an agent asks.

Each declared panel gets the commands <panel>.focus and <panel>.toggle.

A side area lies beside the centre (an egui side panel, taking the centre’s room) or over it (Placement::Over): its folded strip keeps the room in the layout, so the centre keeps its width, and the area, unfolded, lies above the centre next to its strip with the kit’s side-area shadow (egui_stack’s ZoneState::over). It is a lasting placement: a click away or Escape leaves it, only a click on the strip folds or unfolds it; its edge on the centre’s side resizes it. The centre never folds.

Strip icons. A side area’s strip shows one icon per panel, in tab order: its PanelSpec::icon (a vector icon tinted by the kit’s activity-bar-item, crisp at any scale), else its title’s first letter; the tooltip gives the title and the panel’s key, if it has one. On a folded area a click opens that panel alone as a flyout over the centre, next to the strip, without moving the layout (egui_stack’s LayoutArea::flyout, workbench.flyout); Escape or a click away closes it (it is an overlay of the stack, egui_pop_core::overlay::hold: Escape closes the top overlay first, and a combo box or a context menu opened in it is part of it). A double click on the icon, or the flyout’s pin button, unfolds the area with the panel shown. The flyout’s free edge resizes it; its width is kept per panel in the layout (flyouts, workbench.flyout_size). On an area lying over the centre, open, a click shows the panel. A panel’s indicator (crate::strips::Indicator::panel) shows on its icon while the panel is not shown; strip lists the icons with their marks for agents, as the workbench collector does.

Zen mode (the workbench.zen command, a toggle on Shift+F11 that an application may rebind) leaves one panel alone, full size, in the window holding it: the one named (panel, the panel menu’s “Zen this panel”), else the focused view or mixed panel, else the application’s choice (pop.zen.panel), else the centre’s active tab (with none, the centre whole). The title bar, the menu and status bars, the activity bar, every other panel and the floating panels are hidden, and Escape (workbench.leave_zen) brings them back: zen mode changes only what is drawn, never the layout. The way out stays in sight: a strip at the top centre says how to leave, with a “Leave zen mode” button, for a few seconds on entering, and again whenever the pointer reaches the top edge. It is a state of the session, not of the layout: never saved, so the next start shows the whole workbench.

A panel may also float over the interface: a palette (PanelSpec::palette) does when it opens, any floatable panel when asked (its tab menu’s Float). Floating panels are drawn by crate::palettes, with steps of their own (palette.open, palette.float, palette.dock, palette.move, palette.roll, palette.pin, palette.group, palette.ungroup, palette.close_group).

Modules§

instances
Panel instances: a panel declared with several (PanelSpec::instances, Instances::Multiple) opens as many times as asked.
panel_menu
The panel menu: one context menu for a panel wherever it is, docked (its tab, which egui_stack opens), floating (its title and its tabs) or detached (its window’s tabs).
window_areas
Each application window’s own workbench: a centre, start and end side areas and a bottom area around the window’s content, each holding panels as tabs and splits, as the main window’s areas do (Layout::windows, saved with the layout).

Structs§

DockControls
The controls the workbench’s docks show beyond the tabs, as the application sets them (AppBuilder::dock_controls). Each follows egui_stack’s default: what is off there is off here.
DropHint
The drop hint shown while a tab is dragged (in its area or over another), or a palette over an area it docks in: what AppHandle::drop_hint, overlay_rects (drop:<panel>:<area>) and the workbench collector report.
GroupHandles
The handles that move a whole tab group (a leaf with all its tabs), set with DockArea::group_handles. A set of flags: combine them with |. By default every handle is on (ALL). A floating window’s move handle (MOVE_WINDOW) is set here too: it moves the window, not a group.
MoveFrom
Where a drag moves a floating window besides its move handle and its title bar, which always move it; set with FloatsArea::move_from. By default BAR: only them. Combine the others with |:
StripIcon
A panel’s icon in a side area’s strip, as agents read it (strip, the workbench collector’s strips).
TabBar
An area’s first tab bar as drawn last frame, where a drop on the area adds its tab: the bar, the right edge of its last tab, its tab count.
TabPreview
Where a drop hint draws a dragged palette’s tab (the kit’s tab-preview): in the target area’s tab bar, after its tabs, where a drop on the area puts it.
WindowDrop
A tab dragged over a detached panel’s window: a drop there moves it into that window, as a tab (workbench.join_window).

Enums§

Arrangement
How Change::Arrange lays out the groups beside a panel’s.
Change
A change of the workbench, as a step runs it.
FloatMove
What moving a floating window does, by its title bar or its move handle (GroupHandles::MOVE_WINDOW); set with FloatsArea::float_move.
FloatScope
Which panels may float (SETTING_FLOAT_PANELS): it narrows what each panel declares (PanelSpec::floatable), never widens it.
GroupModifier
The key held while dragging a tab to carry its whole group (SETTING_GROUP_DRAG_MODIFIER).
PanelAlignment
How the bottom panel lines up with the side bars.
ShellSize
A size across an area set by the application (AppBuilder::shell_panel_min_size, shell_panel_max_size, centre_min_size): points, or a share of the window’s content (0.6: 60 % of its width). A plain number is points.

Constants§

CMD_ARRANGE_COLUMN
Lays out the focused panel’s group and its neighbours in a column.
CMD_ARRANGE_GRID
CMD_ARRANGE_ROW
Lays out the focused panel’s group and its neighbours in a row.
CMD_LEAVE_ZEN
CMD_MOVE_TO_WINDOW
Lays out the focused panel’s group and its neighbours (the row, column or grid holding it) as a grid. Moves a panel into a detached window, as a tab (panel: the focused one by default; window: a panel of that window).
CMD_NEXT_REGION
CMD_NEXT_TAB
Leaves zen mode (Escape while in it). The keyboard to the next region of the window (F6): see Moving between regions. The keyboard to the next tab of the focused panel’s tab group (Ctrl+Page Down).
CMD_PREVIOUS_REGION
The keyboard to the previous region of the window (Shift+F6).
CMD_PREVIOUS_TAB
The keyboard to the previous tab of the focused panel’s tab group (Ctrl+Page Up).
CMD_ZEN
Toggles zen mode: one panel alone, full size, in its window (panel, else the panel that matters now: see AppHandle::zen_target); the centre whole when there is none.
DEFAULT_GROUP_HANDLES
The group handles an application allows unless it says otherwise (AppBuilder::group_handles): every handle, the tab menu’s “Move group” included, whose list names the areas by their translated titles and the panels they hold.
DETACHED
Where a panel detached without a known place opens, and its size.
PANEL_INSPECTOR
PANEL_MAIN
PANEL_SIDE_BAR
The shell’s zones as panels.
SETTING_FLOAT_MOVE
The setting: what moving a floating window does (see float_move).
SETTING_FLOAT_PANELS
The setting: which panels may float over the interface (see FloatScope); it only narrows what each panel’s spec allows.
SETTING_GROUP_DRAG_MODIFIER
The setting: the key held while dragging a tab to carry its whole group (Shift, Ctrl or Alt; see GroupModifier).
SETTING_GROUP_EMPTY_SPACE
The setting: whether the empty part of a tab bar drags its group.
SETTING_GROUP_GRIP
The setting: whether a grip at the end of each tab bar drags its group.
SETTING_GROUP_MENU
The setting: whether the tab menu offers “Move group”.
SETTING_GROUP_MODIFIER_DRAG
The setting: whether a tab dragged with the group modifier (SETTING_GROUP_DRAG_MODIFIER) carries its group.
SETTING_GROUP_MOVE_WINDOW
The setting: whether a floating window shows a move handle.
SETTING_PANEL_ALIGNMENT
The setting: how the bottom panel lines up with the side bars, as VS Code’s panel alignment (see PanelAlignment).
STACK_DROP
The workbench’s listener of stack.dock.drop: the panels’ rules refuse a tab dragged into an area it stays out of, with the reason.
STACK_LAYOUT
The workbench’s listener of stack.layout.changed: the shell follows the zones the user resized, folded and unfolded, and the flyouts.
STEP_ARRANGE
STEP_ATTACH
STEP_CLOSE_WINDOW
STEP_DETACH
STEP_DOCK_BACK
STEP_FLYOUT
STEP_FLYOUT_SIZE
STEP_FOCUS
STEP_FOLD
STEP_HIDE
STEP_JOIN_GROUP
STEP_JOIN_WINDOW
STEP_MOVE
STEP_PLACE
STEP_SHOW
STEP_ZEN

Functions§

area_from
An area from its name.
area_name
An area’s name in documents and arguments.
dock_controls
The dock controls in force (DockControls): the application’s, or the last set_dock_controls.
float_move
What moving a floating window does, as the setting says now: FloatMove::Move (only moves it) unless the user chose dock.
float_scope
Which panels may float, as the setting says now.
group_drag_modifier
The key held while dragging a tab to carry its group, as the setting says now.
group_handles
The handles that move a whole tab group: those the application allows (AppBuilder::group_handles) that the user left on in the settings.
panel_alignment
The bottom panel’s alignment, as the setting says now.
set_dock_controls
Changes the dock controls while running, from the next pass: a settings page or a demonstration turning the “Eject group” buttons on.
strip
Every icon of the side areas’ strips (an area folded, or lying over the centre), start side first, each in tab order, with its panel’s indicator; none for a bare strip (AppHandle::bare_strip). Empty in zen mode.
window_id
A detached panel’s window id.