Skip to main content

Module frame

Module frame 

Source
Expand description

The frame every app shares (Shell): an app hands it its registry, its workspaces, its menus and its Settings sections (ShellSpec), and the frame draws them the same way in every app (Design System, “The frame”):

  • Title bar, left to right: the app’s mark, the general menus (File · Edit · View · Help), a divider, then the app’s views in one switcher (Explore, Sorting, Curation, Analysis…). At the right: search, the project, who works, where the app runs, the shared workspaces as icons (Pipeline, Code: the same in every app, Placement::Shared), the layout toggles and the theme. While a shared workspace is open the switcher shows no view as current.
  • File keeps its usual items: Open… (the file picker, crate::picker_view, only when the app says what it opens: OpenSpec), the app’s own (Open recent, Save, Export…), Settings and Quit.
  • Menu row: the current workspace’s menus, built from the registry.
  • Body: the current workspace’s view, a card on the chrome.
  • Status bar: a status line, the running jobs (crate::jobs) with a cancel button each, and this computer’s load (CPU, memory).
  • Settings (Ctrl+,): sections on the left (Appearance, built in, then the app’s), the section’s settings on the right.
  • Search (Ctrl+K, F3) over the registry.
  • Window frame: where the app draws its own frame (client-side decorations on Linux), the window has rounded corners while it floats and resizes from its own edge; no shadow margin (compositors that do not draw it showed what was behind the window there).
  • Overlay: one view of the app’s over everything (Shell::set_overlay: a help sheet, a dialog).

The frame adapts to the window’s own width (TitleFit): under TITLE_COMPACT_W the views show as icons; under PANELS_W a workspace’s side panes move into the Panels drawer (WorkspaceSpec::drawer; the app asks fit and leaves them out of its own layout); under TITLE_NARROW_W the four general menus fold into one menu button, and the layout toggles and the theme into a “More” menu.

The frame adds its own commands to the registry (shell.search, shell.settings, shell.theme, shell.open, shell.quit, shell.panels, shell.workspace.<id>), so they are in the search and an agent’s tools too. Keys: Ctrl/⌘+1…9 the views in order, Ctrl/⌘+Alt+P Pipeline, Ctrl/⌘+Alt+C Code, Ctrl/⌘+O Open…, Ctrl/⌘+\ the Panels drawer.

Structs§

OpenSpec
What File → Open… opens: the kinds the app reads, where to start, and what to do with the file picked.
RemoteSpec
Where the app runs, at the right of the title bar (as VS Code’s remote indicator): this computer, or a server. Its menu lists the places.
SettingsSection
A section of Settings an app registers (Compute, Models, Plugins…).
Shell
The frame.
ShellSpec
What an app hands the frame.
WorkspaceSpec
A workspace of the app (Explore, Pipeline, Analyze; Sorting…).

Enums§

Placement
Where a workspace sits in the title bar.
ShellEvent
What the frame tells the app.
TitleFit
How much of the frame fits a window width px wide (see TITLE_COMPACT_W, PANELS_W, TITLE_NARROW_W). Ordered: Narrow < Medium < Compact < Full.

Constants§

CODE_ID
The shared Code workspace’s id.
CODE_KEY
Code’s key: Ctrl/⌘+Alt+C.
MENU_ROW_H
Height of the menu row (px).
PANELS_W
Below this window width (px) a workspace’s side panes move into the Panels drawer.
PIPELINE_ID
The shared Pipeline workspace’s id.
PIPELINE_KEY
Pipeline’s key: Ctrl/⌘+Alt+P.
RESIZE_BAND
The band at the window’s own edge that resizes it while it floats (px).
STATUS_BAR_H
Height of the status bar (px): one 24 px target.
TITLE_BAR_H
Height of the title bar (px).
TITLE_COMPACT_W
Below this window width (px) the views show only their icons, the title bar drops the project name and shows the remote as an icon (a small laptop window, a tablet held upright).
TITLE_NARROW_W
Below this window width (px) the general menus fold into one menu button, and the layout toggles and the theme button into one “More” menu (a phone held upright).
WINDOW_RADIUS
Rounded corners of the window while it floats (px).

Functions§

fit
The fit of window (TitleFit::of its width): a workspace’s view asks it to leave its side panes out (they are in the drawer) and to stack its panes when narrow.
frame_rounded
Whether the window draws its own rounded frame: client-side decorations on a floating window (square when maximised, full screen or tiled).
resize_edge
The edge a press at p (window px) resizes, within RESIZE_BAND of a size window’s edge.

Type Aliases§

SectionBody
Draws a Settings section’s body.
StatusItems
Draws the app’s readings in the status bar.