Nucleus
Tool windows

Tool windowsNew

Satellite palettes that dock and Chrome-like tabs that tear off, and the workspace model they share.

View as Markdown

Nucleus ships two tool window archetypes, declared from nucleusApplication and included in nucleus-application: satellite palettes that float beside a document or dock into it, and Chrome-like tabs that tear off into windows of their own.

Every API in this section is @ExperimentalNucleusApi at level ERROR. Add @OptIn(ExperimentalNucleusApi::class), or opt the module in with optIn.add("dev.nucleusframework.window.ExperimentalNucleusApi") in kotlin.compilerOptions.

Pick an archetype

Satellites: the floating Tools and Layers palettes follow the document as it moves; Dock puts Layers in the document, Float takes it back out

Tabs: reordering a tab, tearing one off into its own window, then dropping it back on the strip

SatellitesTabs
What the user seesTool palettes, inspectors, panes around a documentDocuments as tabs in a strip at the top of each window
Who opens windowsYou open the document windows; palettes follow the focused oneThe workspace: one window per group of tabs
MovesFloat ↔ dock, dock ↔ dock, between document windowsReorder, tear off, merge into another window
DeclarationSatellite(workspace, id, title) { … }Tab(workspace, id, title) { … }
PageSatellites, DockingTabs

The two compose: a tab window can host its own DockLayout. See Compose tabs with satellites. Satellite, SatelliteWindow, Tab and TabWindows live in dev.nucleusframework.application, the rest in dev.nucleusframework.window.tao.

Shared ideas

  • The workspace owns placement. Declare each satellite or tab once, at application scope. The workspace picks the host window and moves it on drag. initialPlacement, initiallyOpen and group apply on the first declaration of an id only.
  • Entries outlive composition. A satellite or tab declared again resumes where it was. snapshot() and restore() persist the layout.
  • State follows the content. rememberSaveable survives every move between windows. Plain remember does not: hoist it or make it saveable.
  • View models follow the content too. viewModel { } inside a satellite or a tab belongs to it, not to the window showing it. Its view models survive moves, docking, undocking and hiding, and a SavedStateHandle keeps its values across a move. They are cleared when a tab is closed, or when the Satellite or Tab declaration leaves the composition. See View models and lifecycle.

Two ways to carry a drag

SatelliteWorkspace.dragKind and TabWorkspace.dragKind hold the WorkspaceDragKind of the drag in flight, or null.

ValueWhenWhat follows the pointer
WindowWindows, macOS, X11, XWaylandA real window, or a ghost window
TransferTaoWindow.canPlaceOnScreen == false (native Wayland)The compositor's drag icon; dragGhost stays null

Branch Wayland-sensitive chrome on TaoWindow.canPlaceOnScreen, or SatelliteScope.isCompositorPlaced, never on the compositor name. NUCLEUS_TAO_LINUX_RENDERER=x11 runs the app on XWayland and restores window-following drags. A layout of your own carries its drags the same way with the transfer drag API. See Carry a cross-window drag on Wayland.

Try them in the Nucleus Lab

Each archetype has a probe in the Nucleus Lab. Open one with ./gradlew :examples:lab:app:run -Dlab.probe=<id>.

ProbeWhat it shows
workspace.satellitesShared palettes, owner follows focus or a pin, drag to dock, layout snapshots
workspace.tabsTear-off, merge, reorder, hover cards with thumbnails, the strip drawn with Jewel's TabStrip
workspace.tab-satellitesOne SatelliteWorkspace per tab window
workspace.reader-dockRight-to-left reader: layered sides, custom splitters and headers, fixed panes

What's next

  • Satellites: declare palettes and let them follow the focused document.
  • Docking: lay docked panels out around your content.
  • Tabs: turn documents into tabs that tear off into windows.
  • Linux and Wayland: what a compositor-placed window changes.
Was this page helpful?
Edit on GitHub

Last updated on