Skip to main content

Slint basics

Taunus draws every screen with Slint, a declarative UI language compiled into Rust. You write the UI in .slint files and the logic in Rust; they talk through properties, callbacks and globals.

Read Slint's own documentation for the language:

Taunus uses Slint 1.x (the version pinned in the root Cargo.toml); look at the matching version of the docs.

What Taunus adds​

Instead of…Use…Why
std-widgets.slint@taunus/index.slintThe Taunus look, both form factors, the focus engine
colours and sizes in the codeTheme tokensThey follow the wallpaper, the text size and the form factor
a bare TouchArea as a buttonTappable, Button, ListRowA bare TouchArea can't be reached by remote or keyboard
"text"@tr("key")Translations
PopupWindowPopup, Dialog, MenuFocus trap, Back, safe area

Patterns used across the apps​

  • One global per app (export global Hello { … }) holds the state Rust sets and the callbacks Rust handles. Pages read it directly, so no properties have to be passed through every component.
  • Rust owns the state. The UI shows it and reports what the user did; it never keeps the only copy.
  • Work off the UI thread. Anything slow (D-Bus, sockets, files, the network) runs on a thread and comes back with weak.upgrade_in_event_loop(…) or slint::invoke_from_event_loop(…).
  • Models (VecModel in an Rc) for lists: change the rows in place instead of setting a new model, so the list keeps its scroll position and focus.