rune.ui
Arrange the screen and render status bars. For task-oriented introductions, see Layout & UI and Bars.
Quick reference
Section titled “Quick reference”rune.ui.layout(config) -- set the dock layoutrune.ui.bar(name, render_fn, opts?) -- register a bar rendererrune.ui.refresh_bars() -- request an immediate re-renderrune.ui.bar returns a handle and accepts
the common options.
rune.ui.layout
Section titled “rune.ui.layout”rune.ui.layout(config)config(table) —topand/orbottomarrays of dock entries. Each entry is a string (the component name) or a table with options:{name = "tells", height = 8}. Built-in components:"input"(the command line),"status"(the default status bar), and"separator"(a horizontal rule); anything else names a bar or pane.
-- The default layoutrune.ui.layout({ bottom = { "input", "status" }})
-- Add a chat pane to the top dockrune.ui.layout({ top = { {name = "tells", height = 8} }, bottom = { "input", "status" }})rune.ui.bar
Section titled “rune.ui.bar”rune.ui.bar(name, render_fn, opts?) -> handlename(string) — the bar’s layout name ("status"replaces the built-in status bar).render_fn(function) —function(width); called on the render tick (roughly every 250ms) with the terminal width. Return a string, a{left, center, right}table, ornilto skip this render.opts(table, optional) — common options.
Bars are pull-based: rune asks your renderer for current content instead of you pushing updates. A renderer that errors on 3 consecutive renders is quarantined; re-registering the name gives it a fresh start. For a status bar built on client state, see State & Lines.
rune.ui.bar("clock", function(width) return { right = os.date("%H:%M") }end)rune.ui.refresh_bars() requests an immediate re-render instead of
waiting for the tick — call it after changing the state a renderer
reads, e.g. in a GMCP vitals handler.
Managing
Section titled “Managing”Standard registry management applies:
rune.bars.enable/disable/remove(name), .list(), .count(),
.clear(), .remove_group(group) — see
Registries. These address the name
option, not the bar name. /bars lists everything.
Related: Bars guide · rune.pane · State & Lines