Getting started
The package is sigil-ui. The library name is sigil, so imports read sigil::.
Requirements
- Rust 1.90 or newer.
- On Linux, the window host needs the GTK3, udev, ALSA, xkbcommon, and xdo development packages. On Debian and Ubuntu:
sudo apt-get install libgtk-3-dev libudev-dev libasound2-dev libxkbcommon-dev libxkbcommon-x11-dev libxdo-dev. The terminal host needs none of them. - A wgpu-capable GPU for the default renderer of the window host. Set
SIGIL_BACKEND=cputo use the CPU renderer. The terminal host needs no GPU.
Install
Sigil needs Rust 1.90 or newer. Add the package with the window host:
[dependencies]sigil-ui = { git = "https://github.com/manaforged/sigil" } For the terminal host only, without the GPU stack:
[dependencies]sigil-ui = { git = "https://github.com/manaforged/sigil", default-features = false, features = ["terminal"] } Open a window
Write use sigil::prelude::*;. The prelude brings in run, Host, root, the widgets, and the signals.
use sigil::prelude::*; fn main() -> sigil::AppResult<()> { sigil::run(AppConfig::new("Sigil - hello-counter").size(480, 240), app_tree) } fn app_tree() -> impl IntoNode { let count = signal(0_i32); column() .layout(LayoutStyle::default().padding(32.0)) .bg(Token::Surface) .child(text(move || format!("Count: {}", count.get()))) .child(button("Increment").primary().activate(move || count.update(|n| *n += 1))) }use sigil::prelude::*; fn main() -> sigil::AppResult<()> { sigil::run( AppConfig::new( "Sigil - hello-counter", ) .size(480, 240), app_tree, )} fn app_tree() -> impl IntoNode { let count = signal(0_i32); column() .layout( LayoutStyle::default() .padding(32.0), ) .bg(Token::Surface) .child(text(move || { format!("Count: {}", count.get()) })) .child( button("Increment") .primary() .activate(move || { count.update(|n| *n += 1) }), )}Run in a terminal
Turn on the terminal feature and call .terminal() on the config.
use sigil::prelude::*; fn main() -> sigil::AppResult<()> { sigil::run(AppConfig::new("hello-terminal").terminal(), || { text("hello") })}use sigil::prelude::*; fn main() -> sigil::AppResult<()> { sigil::run( AppConfig::new("hello-terminal") .terminal(), || text("hello"), )}Features
| Feature | Default | Enables |
|---|---|---|
desktop | yes | The window host for run, open, and the OS clipboard. Turns on scene, clipboard, and winit with AccessKit. |
terminal | no | The terminal host: run with .terminal(), and sigil::terminal, including sigil::terminal::render. Uses crossterm and enables image-decode. |
scene | via desktop | The wgpu renderer, the CPU renderer, offscreen capture through sigil::renderer::capture, text shaping, SVG icons, and sigil::text. No window. |
shell | via desktop | The winit window shell with AccessKit. |
cpu | via scene | The CPU renderer that SIGIL_BACKEND=cpu selects. |
shaping-complex | via scene | Complex-script text shaping through HarfRust. |
render | no | Scene rendering without a window. Turns on scene. |
clipboard | via desktop | OsClipboard, the system clipboard. |
clipboard-image | no | sigil::clipboard::image(), images from the system clipboard. |
image-decode | no | image_bytes, and data: images in markdown. |
dialog | no | sigil::app::dialog: in-app open, save, folder, message, and confirm dialogs on either host. |
native-dialog | no | Native dialogs on the window host; the terminal host keeps the in-app dialogs. Turns on dialog and desktop. |
menu | no | sigil::app::menu: native application menus. Turns on desktop. |
tray | no | sigil::app::tray: system tray icons and events. Turns on menu. |
audio | no | Player for audio playback. |
notify | no | Desktop notifications through sigil::app::notify. |
media | no | Now-playing metadata and media-key events through sigil::app::media. Turns on desktop. |
hotkey | no | Global keyboard shortcuts through sigil::app::hotkey. Turns on desktop. |
hot | no | Code hot reload under dx serve --hot-patch: run mounts the root again after each patch; an embed host uses Host::mount_hot. Uses subsecond and dioxus-devtools. Not on wasm. |
pty | no | Session: a child process on a pseudo-terminal. |
kittest | no | Test support for sigil-kittest. Not API. |
test-clock | no | Manual interval clock for tests. |
inspect | no | The local inspection socket when SIGIL_INSPECT is set. |