Skip to main content

CamoDockLayout

IDE-style tool windows around a center: docks on the left, right and bottom that open from icon stripes on the window's edges. A stripe button toggles its tool window, several open windows on one edge stack in a split of their own, and docks resize through the split pane's divider. Each window's header has a "Move to" menu, maximize or restore and hide. The app owns the layout in a CamoDockState, which it can save and restore with snapshot() and apply(). focus(id) opens a window and moves keyboard focus into it, for your own shortcuts; Esc inside a window returns focus to the center. Left and right mean start and end, so a layout mirrors in right-to-left.

Usage​

val state = remember {
CamoDockState(
mapOf("files" to DockEdge.Left, "details" to DockEdge.Right, "log" to DockEdge.Bottom),
open = setOf("files"),
)
}
val windows = listOf(
CamoToolWindow("files", "Files", { Icon(FilesIcon) }, DockEdge.Left) { FileTree() },
CamoToolWindow("details", "Details", { Icon(InfoIcon) }, DockEdge.Right) { Details() },
CamoToolWindow("log", "Log", { Icon(LogIcon) }, DockEdge.Bottom) { LogView() },
)

CamoDockLayout(state, windows) { Editor() }

// From your own shortcut: open the Log and move focus into it
state.focus("log")

API​

public fun CamoDockLayout(
state: CamoDockState,
toolWindows: List<CamoToolWindow>,
modifier: Modifier = Modifier,
center: @Composable () -> Unit,
)
NameTypeDefault
stateCamoDockStaterequired
toolWindowsList<CamoToolWindow>required
modifierModifierModifier
center@Composable () -> Unitrequired
Design notes

Why CamoDockLayout works this way, its states and its edge cases: contributor docs.