Build: link-time optimization on with Apple Clang; drop the LTO comparison
Reaktor
A Nuklear-powered GUI library for C.
Tired of C relying on heavy toolkits that want hundreds of megabytes and a dozen dependencies just to put a dialog on screen? And of small alternatives always lacking crucial features? No? But I was, so I wrote Reaktor: complete without being big. A 2.1 MB binary, 7–13 MB of RAM, and no GPU required.
Try the showcase in your browser, the same program built to WebAssembly, or download it for Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, or as WebAssembly to serve yourself.
⚠️ Reaktor is in active development; breaking changes may occur.
How, and on what, is in PERFORMANCE.md.
Features
- 24 declared widgets: buttons, fields, checks, radios, sliders, knobs, spinners, combos, color, date and time pickers, sidebar, tabs, a menu bar, tables, trees and a splitter, with tooltips and rows that drag between lists. All of Nuklear is underneath, under Reaktor's names.
- Layers: menus in windows of their own, in-window dialogs, modal questions, toasts, more native windows, and a tray icon with a menu.
- Services: system open, save and folder pickers, timers, main-thread posting, persistent settings, undo, system notifications, printing and PDF export.
- Styled by CSS read at run time: color, type, borders, radii, spacing,
:hoverand:active, light and dark. Swap the sheet and the app changes. - Accessible with no code: UI Automation, NSAccessibility, AT-SPI and a DOM subtree on the web, and keyboard navigation throughout.
- Localization: catalogs, plural rules, and numbers, money and dates as each language writes them.
- Text past Latin-1: direction, shaping, fallback fonts and Unicode line breaking, so Japanese wraps properly.
- Animation: tweens keyed per widget on 31 curves, springs, steps and béziers; keyframed clips staggered across a grid; motion paths, oscillators, noise and shakes; colors blended in five spaces; text that arrives a glyph at a time. Idle once everything settles.
- Modular: accessibility, localization, text shaping, settings, the tray, popup windows, notifications, printing and the Inspector each swap for a stub at build time. Only what they drew goes; every other pixel stays.
- Windows, macOS, Linux, the BSDs and WebAssembly from one set of sources and one software rasterizer, at any display scale: x86 and ARM everywhere, RISC-V on Linux (Platforms).
- Nothing drawn at rest — 0% of a core while it sits there.
Build
CMake, the submodules and a C11 compiler: Reaktor is C99, but mojibake, which the Text module uses, is C11.
git clone --recursive https://github.com/Alpaq92/Reaktor
cd Reaktor
./build.sh # build.ps1 on Windows
./build/showcase
./build-wasm.sh (build-wasm.ps1 on Windows, with
emsdk) builds the web versions into build-wasm/,
to be served over HTTP.
For your own application, add_subdirectory Reaktor and declare the app with
reaktor_add_app, or take a libreaktor package from the
releases and
find_package(reaktor): In your own project.
Install
On Linux and the BSDs, one script builds libreaktor as a system package
(.deb, .rpm, FreeBSD, OpenBSD or NetBSD) and installs it:
sh tools/libreaktor-pkg.sh -i
It lands in /opt/reaktor (/usr/local/reaktor on the BSDs); build against
it with -DCMAKE_PREFIX_PATH=/opt/reaktor, or pkg-config with
PKG_CONFIG_PATH=/opt/reaktor/lib/pkgconfig. The package manager removes it:
it is libreaktor everywhere. -s also builds libreaktor.so and packs
three packages instead: libreaktor-sdl3-0 and libreaktor1 to run an app,
libreaktor-shared to build one. libreaktor and libreaktor-shared
conflict; install one.
Usage
static char name[64];
static int len;
REAKTOR_COLUMN(.gap = 10) {
reaktor_label(&(reaktor_label_spec){ .text = "What is your name?" });
reaktor_field(&(reaktor_field_spec){
.buf = name, .len = &len, .cap = sizeof name, .hint = "Ada" });
if (reaktor_button(&(reaktor_button_spec){ .label = "Say hello" }))
printf("Hello, %s!\n", name);
}
No colors, radii, padding or font sizes: a stylesheet read at startup gives them. Nothing for screen readers either: each widget reports its name, value and position.
Made of
Nuklear draws the widgets. SDL3 supplies the window, input, software renderer, and the tray on Windows and macOS; on Linux and the BSDs the tray is Reaktor's, over the D-Bus client gibus. Reaktor's own CSS engine reads the stylesheets. Onlay, a fork of randrew/layout, computes the rectangles, and NukAnim, a port of ImAnim, moves them. Every dependency is a submodule, used as it ships; the full list is in NOTICE.md.
Documentation
- DOCUMENTATION.md: every widget, layout, layer and style, then how it works inside.
- FAQ.md: short answers to common questions.
- DEMO.md: the four programs in this repository.
- PERFORMANCE.md: what it costs, measured.
- BENCHMARKS.md: the comparison, as runnable projects.
- NOTICE.md: dependencies and licenses.
License
MIT. The dependencies keep their own; see NOTICE.md.
