Reference
API index
Over 1,600 public items from all six libLuna crates. This index is generated directly from the sources and can be searched by name, module, signature and description. The complete, authoritative rustdoc is built with one command.
Six crates, one contract
libluna start here
Facade: core, render, platform, widgets, i18n and prelude. A typical app adds only this crate.
libluna-core
Geometry, colour, scale, events, motion, theme, tokens, appearance settings, icons and locale.
libluna-render
Scene graph, draw commands, text, SVG, wallpapers and the CPU backend.
libluna-platform
run, Frame, AppConfig, xdg-shell windows, wlr-layer-shell panels, clipboard.
libluna-widgets
PaintCtx, 77 widgets, container families, the Node/Layout layout tree, hover.
libluna-i18n
Locale, Catalog, tr, tr_args, the t! macro and .lang file loading.
prelude — the shortest path
For most applications use libluna::prelude::*; is enough. It re-exports the most commonly used types:
pub use crate::core::event::{
ButtonState, Event, KeyEvent, Modifiers, PointerButton,
};
pub use crate::core::{
Accent, Color, Insets, Point, Rect, Size, Theme,
ThemePreference, ThemeSettings,
};
pub use crate::i18n::{set_locale, tr, Locale};
pub use crate::platform::{run, AppConfig, Frame};
pub use crate::render::{Scene, SoftwareRenderer, TextEngine, TextRun};
pub use crate::widgets::{NavEntry, NavList, PaintCtx, ViewSwitcher};
The t! macro lives at the crate root, not in the prelude: use libluna::t;.
libluna-core
| Item | Signature / role |
|---|---|
Point, Size, Rect, Insets | Geometry in logical pixels; Rect::from_xywh, contains, inflate, deflate, intersection. |
Color | Color::rgb, rgba, from_rgba8, from_hex, with_alpha, lerp. |
Scale | Scale::new(factor), to_physical, to_logical. |
Event | PointerButton, PointerMotion, PointerLeave, Scroll, Key, Text, Paste, Window. |
Theme | Theme::light(), Theme::dark(), accented(accent, fg); fields colors, spacing, radius, typography, metrics. |
Accent | ALL, name(), from_name(), color(), foreground(). |
ThemePreference | System, Light, Dark; resolve(system_dark, accent). |
ThemeSettings | Persistent settings: preference, accent, style; load()/save(). |
theme_file | ThemePatch, StyledTheme, available_themes(), load(id). |
motion | Easing, lerp, Animation::{animate_to, jump_to, advance}. |
IconSet, IconTheme | System icon discovery and the Luna/monochrome icon theme. |
libluna-render
let mut scene = Scene::new();
scene.fill_rect(rect, color);
scene.fill_rounded_rect(rect, radius, color);
scene.stroke_rounded_rect(rect, radius, 1.0, border);
scene.push_clip(rect);
scene.text(
TextRun::new(Point::new(24.0, 48.0), "Hello", 14.0)
.with_weight(700)
.with_color(color),
);
scene.pop_clip();
let mut renderer = SoftwareRenderer::new(800, 600);
renderer.draw(&scene, 1.0, background);
let png = renderer.encode_png();
| Item | Role |
|---|---|
Scene | A list of DrawCommands: shapes, clip, text, images, background. |
TextRun | Text + origin (baseline), size, weight, colour. |
TextEngine | Measurement and rasterisation; TextEngine::system() and mono(). |
SoftwareRenderer | CPU backend; new(w,h), draw, encode_png, data. |
ImageData | RGBA8888 buffer for Scene::image and background. |
decode_svg, scene_to_svg | SVG rasterisation and scene-to-SVG export. |
libluna-platform
| Item | Role |
|---|---|
run(config, |frame| …) | Opens a window or layer surface and calls the closure on every frame. |
AppConfig | new(title), initial_size, app_id, settings, system_dark, layer, transparent, escape_to_exit, monospace. |
Frame | scene, theme, text, size, scale, events, dt plus window, theme and clipboard methods. |
LayerConfig | top_panel, overlay, top_chrome, lock_screen; fields anchor, margin, exclusive_zone. |
InputRegion | Auto (from alpha) or explicit Rects. |
WakeHandle | wake() from another thread — e.g. after a D-Bus event. |
use libluna::platform::{Anchor, Layer, LayerConfig};
let config = AppConfig::new("Panel")
.layer(LayerConfig::top_panel("my-panel", 40, true))
.transparent(true);
libluna-widgets
Widget families available from libluna::widgets:
| Family | Widgets |
|---|---|
| Actions | Button, ToggleButton, LinkButton, ColorButton, SplitButton, MenuButton. |
| Forms | Entry, SearchEntry, PasswordEntry, TextView, SpinButton, Stepper, Slider, Switch, CheckButton, RadioGroup, DropDown, ToggleGroup, Calendar, ColorChooser, EmojiChooser. |
| Navigation | ViewSwitcher, NavList, NavigationRail, TabBar, TabView, PathBar, Pager, NavigationView, NavigationSplitView, OverlaySplitView, Sidebar, PopoverMenuBar, Menu. |
| Layout | Card, PreferencesGroup, PreferencesPage, ActionRow, Row, Expander, FlowBox, Paned, Stack, Grid, Fixed, CenterBox, Bin, Clamp, AspectFrame, Frame, Overlay, Revealer, WrapBox, BreakpointBin, ButtonContent, ToolbarView, Viewport, WindowHandle, ActionBar. |
| Collections | ItemView, ColumnView, ScrollView, Scrollbar, Adjustment. |
| Media | MediaControls, Picture, Image, Avatar, IconName. |
| Feedback | InfoBar, Banner, Toast, StatusPage, Statusbar, Popover, Tooltip, Spinner, ProgressBar, LevelBar. |
| Windows | HeaderBar, WindowTitle, Dialog, AlertDialog, AboutDialog, ShortcutsDialog, PreferencesDialog, BottomSheet, Assistant. |
let mut ctx = PaintCtx::new(scene, &theme, text);
let width = ctx.measure("Save", 14.0, 400);
ctx.label_left(24.0, 48.0, "Save", 14.0, 400, ctx.text_color());
ctx.label_center(160.0, 48.0, "Center", 14.0, 700, ctx.accent());
ctx.label_right(296.0, 48.0, "End", 14.0, 400, ctx.dim_text());
Layout
| Item | Role |
|---|---|
Node | Fixed, Label, Spacer, VBox, HBox, Padding, Expanded, Center; helpers vbox, hbox, fixed, label, gap, padded. |
Constraints | loose, tight, unconstrained, deflate, constrain. |
LayoutCtx | theme + text; needed to measure labels. |
Layout | new(root), desired_size, fit(rect, ctx) -> Vec<Rect>. |
libluna-i18n
| Item | Role |
|---|---|
Locale | new(tag), from_env(), language(). |
set_locale(locale) | Sets the global language. |
tr(key), tr_args(key, args) | Translation and {name} substitution. |
t! | Macro shorthand: t!("Settings"), t!("Hello, {name}", name = "Ania"). |
Catalog | parse(src), get(key), name(). |
load_catalogs_from_dirs() | Loads extra .lang files from user and system directories. |
Metric groups
Metrics is split into 32 groups. Each is available as theme.metrics.<group>.<key>.
Full public item index
Generated by scripts/generate-api-index.py. It covers structs, enums, traits, functions, methods, constants, modules and macros. Each entry shows its crate, module, signature and source link.
This is a best-effort generated index: it lists public declarations found in the sources. Full signatures, trait implementations and related types are in rustdoc.
Full rustdoc
Rustdoc is generated from the same code and adds cross-links between types, implementations and module docs:
# from the repository root
make web-api
# or manually
cargo doc --manifest-path libluna/Cargo.toml --no-deps
# output: libluna/target/doc/libluna/index.html
On the website the result is published under /api/. For local builds, open libluna/target/doc/libluna/index.html directly.