admin 7f7a3b723d Merge pull request #143 from Alpaq92/lto-apple-clang
Build: link-time optimization on with Apple Clang; drop the LTO comparison
2026-11-11 17:16:41 +01:00
2026-11-10 01:23:08 +01:00
2026-11-09 14:23:07 +01:00
2026-11-09 16:32:35 +01:00

Reaktor

A Nuklear-powered GUI library for C.

Two Reaktor showcase windows, the light scheme behind and the dark scheme in front: each has the sidebar of pages with its own scheme chosen at the foot, and the front one shows the Login page's card in a rounded panel

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.

Two bar charts of drawing 64 rotating boxes at 60 fps in an 800x600 window. Memory: Reaktor 9.1 MB, the same program on D3D12 120.3 MB and on OpenGL 68.9 MB, Flutter 132.7 MB, Electron 155.2 MB, Kotlin Multiplatform 668.7 MB. Steady-state CPU as a percent of one core: Reaktor 6.1%, D3D12 5.1%, OpenGL 5.0%, Flutter 15.3%, Electron 20.7%, Kotlin Multiplatform 29.4%

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, :hover and :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

License

MIT. The dependencies keep their own; see NOTICE.md.

S
Description
No description provided
Readme MIT
5.1 MiB
Languages
C 85%
CMake 5.5%
Shell 4.8%
PowerShell 1.6%
Objective-C 0.9%
Other 2.2%