Home

Awesome

libui-ng: a portable GUI library for C

Fork of andlabs/libui. This README is being written.<br> Build Status, GitHub Actions GitLab GitHub

About

Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

Status

libui-ng is currently mid-alpha software.

See CHANGELOG.md

Old announcements can be found in the news.md file.

Runtime Requirements

Build Requirements

Building

libui-ng mainly uses the standard Meson build options.

$ # in the top-level libui-ng directory run:
$ meson setup build [options]
$ ninja -C build

Once this completes, everything will be under build/meson-out/.

libui-ng specific options:

Most important Meson options:

Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run meson.

The Meson website and documentation has more in-depth usage instructions.

For the sake of completeness, I should note that the default value of --layout is flat, not the usual mirror. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.

Backends other than ninja should work, but are untested by me.

Testing

Automated Unit Tests

Run the included unit tests via meson test -C build. Alternatively you can also run the unit executable manually.

Manual Testing Suite

Run the manual quality assurance test suite via qa and follow the instructions laid out within.

Installation

Meson also supports installing from source; if you use Ninja, just do

$ ninja -C build install

When running meson, the --prefix option will set the installation prefix. The Meson documentation has more information, and even lists more fine-grained options that you can use to control the installation.

Arch Linux

Can be built from AUR: https://aur.archlinux.org/packages/libui-ng-git/

Documentation [WIP]

API, check the modules section for an overview of (nearly all) uiControls.

Consult the ui.h comments for the uiControls missing in the docs.

Check the examples directory for fully fledged examples. Check out the tests directory and subdirectories for more real world usage.

Language Bindings

libui was originally written as part of my package ui for Go. Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.

Other people have made bindings to other languages:

LanguageBindings
C++libui-cpp, cpp-libui-qtlike
C# / .NET FrameworkLibUI.Binding
C# / .NET CoreDevZH.UI, SharpUI
CHICKEN Schemewasamasa/libui
Common Lispjinwoo/cl-ui
Crystallibui.cr, hedron, iu
DDerelictLibui (flat API), libuid (object-oriented)
Euphorialibui-euphoria
Harbourhbui
Haskellhaskell-libui
JanetJanetUI
JavaScript/Node.jslibui-node, libui.js (merged into libui-node?), proton-native, vuido
JuliaLibui.jl
Kotlinkotlin-libui
Lualibuilua, libui-lua, lui, lui
Nimui, uing
Perl6perl6-libui
PHPui, Ardillo
Pythonpylibui
RingRingLibui
Rubylibui-ruby, LibUI, Glimmer DSL for LibUI
Rustlibui-ng-sys, boing, libui-rs, libui
Scalascalaui
Swiftlibui-swift
Zigzig-libui-ng

Frequently Asked Questions

Why does my program start in the background on OS X if I run from the command line?

OS X normally does not start program executables directly; instead, it uses Launch Services to coordinate the launching of the program between the various parts of the system and the loading of info from an .app bundle. One of these coordination tasks is responsible for bringing a newly launched app into the foreground. This is called "activation".

When you run a binary directly from the Terminal, however, you are running it directly, not through Launch Services. Therefore, the program starts in the background, because no one told it to activate! Now, it turns out there is an API that we can use to force our app to be activated. But if we use it, then we'd be trampling over Launch Services, which already knows whether it should activate or not. Therefore, libui does not step over Launch Services, at the cost of requiring an extra user step if running directly from the command line.

See also this and this.

Contributing

See CONTRIBUTING.md

Screenshots

From examples/controlgallery:

Windows

Unix

OS X