libLuna Documentation
PL EN
GitHub

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:

rust · prelude contents
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

ItemSignature / role
Point, Size, Rect, InsetsGeometry in logical pixels; Rect::from_xywh, contains, inflate, deflate, intersection.
ColorColor::rgb, rgba, from_rgba8, from_hex, with_alpha, lerp.
ScaleScale::new(factor), to_physical, to_logical.
EventPointerButton, PointerMotion, PointerLeave, Scroll, Key, Text, Paste, Window.
ThemeTheme::light(), Theme::dark(), accented(accent, fg); fields colors, spacing, radius, typography, metrics.
AccentALL, name(), from_name(), color(), foreground().
ThemePreferenceSystem, Light, Dark; resolve(system_dark, accent).
ThemeSettingsPersistent settings: preference, accent, style; load()/save().
theme_fileThemePatch, StyledTheme, available_themes(), load(id).
motionEasing, lerp, Animation::{animate_to, jump_to, advance}.
IconSet, IconThemeSystem icon discovery and the Luna/monochrome icon theme.

libluna-render

rust · scene graph
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();
ItemRole
SceneA list of DrawCommands: shapes, clip, text, images, background.
TextRunText + origin (baseline), size, weight, colour.
TextEngineMeasurement and rasterisation; TextEngine::system() and mono().
SoftwareRendererCPU backend; new(w,h), draw, encode_png, data.
ImageDataRGBA8888 buffer for Scene::image and background.
decode_svg, scene_to_svgSVG rasterisation and scene-to-SVG export.

libluna-platform

ItemRole
run(config, |frame| …)Opens a window or layer surface and calls the closure on every frame.
AppConfignew(title), initial_size, app_id, settings, system_dark, layer, transparent, escape_to_exit, monospace.
Framescene, theme, text, size, scale, events, dt plus window, theme and clipboard methods.
LayerConfigtop_panel, overlay, top_chrome, lock_screen; fields anchor, margin, exclusive_zone.
InputRegionAuto (from alpha) or explicit Rects.
WakeHandlewake() from another thread — e.g. after a D-Bus event.
rust · layer panel
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:

FamilyWidgets
ActionsButton, ToggleButton, LinkButton, ColorButton, SplitButton, MenuButton.
FormsEntry, SearchEntry, PasswordEntry, TextView, SpinButton, Stepper, Slider, Switch, CheckButton, RadioGroup, DropDown, ToggleGroup, Calendar, ColorChooser, EmojiChooser.
NavigationViewSwitcher, NavList, NavigationRail, TabBar, TabView, PathBar, Pager, NavigationView, NavigationSplitView, OverlaySplitView, Sidebar, PopoverMenuBar, Menu.
LayoutCard, PreferencesGroup, PreferencesPage, ActionRow, Row, Expander, FlowBox, Paned, Stack, Grid, Fixed, CenterBox, Bin, Clamp, AspectFrame, Frame, Overlay, Revealer, WrapBox, BreakpointBin, ButtonContent, ToolbarView, Viewport, WindowHandle, ActionBar.
CollectionsItemView, ColumnView, ScrollView, Scrollbar, Adjustment.
MediaMediaControls, Picture, Image, Avatar, IconName.
FeedbackInfoBar, Banner, Toast, StatusPage, Statusbar, Popover, Tooltip, Spinner, ProgressBar, LevelBar.
WindowsHeaderBar, WindowTitle, Dialog, AlertDialog, AboutDialog, ShortcutsDialog, PreferencesDialog, BottomSheet, Assistant.
rust · PaintCtx
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

ItemRole
NodeFixed, Label, Spacer, VBox, HBox, Padding, Expanded, Center; helpers vbox, hbox, fixed, label, gap, padded.
Constraintsloose, tight, unconstrained, deflate, constrain.
LayoutCtxtheme + text; needed to measure labels.
Layoutnew(root), desired_size, fit(rect, ctx) -> Vec<Rect>.

libluna-i18n

ItemRole
Localenew(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").
Catalogparse(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>.

  • headerbar
  • button
  • switch
  • slider
  • dropdown
  • menu
  • nav
  • segmented
  • tabs
  • sheet
  • pager
  • pathbar
  • entry
  • itemview
  • scrollview
  • stepper
  • check
  • radio
  • card
  • row
  • toast
  • status
  • spinner
  • tooltip
  • banner
  • avatar
  • shortcut
  • split
  • group
  • bar
  • container

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.

Loading…

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:

bash · generate 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.