Skip to content
lykhonisPublic

About

Modular UI stack: swappable host, compositor, and toolkit for phones, TVs, cars, desktop, and web

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Repository files navigation

Glim

Glim

A modular, GPU-first UI stack in C++, built for AI agents as much as for humans.

CI Platforms: macOS, iOS, tvOS, Linux, Android, Web C++20 License: MIT

Why Glim

  • Layers you can swap. Host, Graphics and Toolkit are separate packages. Use all three, replace one, or skip the toolkit and paint directly.
  • One scene graph. The renderer, hit testing and accessibility walk the same tree. UI blocks, raw paint and native views mix in one frame.
  • Real materials. Liquid glass, frosted backdrops, liquid metal, water, drop shadows, glow and blend modes run on every backend.
  • Same pixels everywhere. Metal, Vulkan, WebGPU and a CPU rasterizer share one compositor, and golden tests pin the output.

Built for agents and humans

An agent can build a Glim app, run it, see it, measure it and fix it without extra tooling. Every app ships the same headless interface:

  • See: --snapshot renders a frame to PNG, so an agent can look at what it built.
  • Read: --dump-a11y prints the UI as text, and --dump-ops saves the recorded op stream so two frames can be compared byte for byte.
  • Drive: --e2e taps, presses keys, scrolls, steps time and asserts text, and --probe runs an interactive session over stdin.
  • Measure: --stats, --trace-frames with a Chrome trace, --soak for op growth and --drive for live input latency.

Humans get the same loop: these flags are the profiler, the test runner and the screenshot tool, and they run in CI as plain tests.

Examples

Infotainment: the cockpit gauges and the 3D city map in flight Infotainment: a flying-EV cockpit. Glass gauges, glow and a live 3D city map under frosted cards. pnpm exec nx run infotainment:run
Smart home: the villa backdrop moves from day to night and the house lights turn on and off Smart home: a glass dashboard over a villa photo. The theme switch turns day into dusk, and the house lights follow the dimmer. pnpm exec nx run smarthome:run
Glass: lenses over scrolling stripes, with the pills merging and parting Glass: the lens materials side by side. Clear and frosted glass, merging pills, liquid metal and water. pnpm exec nx run glass:run

A taste of the toolkit

Effects are tags on any block. Custom elements paint the same effects through their sink, and both mix in one tree.

#include <glim/toolkit.h>
#include <glim/toolkit/host/Host.h>

using namespace glim::toolkit;

Block card() {
  return column(
      glass({.radius = 16}),
      shadow({.sigma = 16.f, .offsetY = 8.f}),
      effectGlow({.radius = 12, .color = 0xff7a3dffu, .intensity = 0.6f}),
      pad(20),
      lines("Glass, shadow and glow are tags.")
  );
}

int main() {
  return host::run({.title = "Hello Glim", .width = 480, .height = 320}, [](const Engine&) {
    return column(pad(32), gap(16), lines("Hello, Glim"), card());
  });
}

Architecture

 Toolkit   glim-toolkit, glim-toolkit-host   blocks, state, layout, animation, a11y
    │
 Graphics  glim-paint, glim-gpu-*            scene, merge, isolate, glass, CPU raster
    │
 Host      glim-shell-*, glim-embed          window, vsync, input, native views
Platform Shell GPU
macOS, iOS, tvOS AppKit, UIKit Metal
Android (phone, TV, AAOS) NativeActivity Vulkan
Linux Wayland Vulkan
Web Emscripten WebGPU
Anywhere any CPU rasterizer

Glim also embeds. A sandboxed guest, such as WASM or an out-of-process UI, encodes one frame packet per vsync, and the native host submits it while keeping its own swapchain and run loop.

Try it

pnpm install
pnpm test
pnpm exec nx run smarthome:run

Every app takes the same headless flags:

glim-smarthome --snapshot out.png                            # see a frame
glim-smarthome --dump-a11y                                   # read the UI as text
glim-smarthome --e2e "~Glim Home;tap:i:5;step:0.5"           # drive and assert
glim-smarthome --trace-frames 20 --trace-json trace.json     # profile in Perfetto
glim-smarthome --soak 20 --stats                             # check for op growth
glim-smarthome --drive examples/smarthome/drive/controls.drive   # live latency report

Building

Prerequisites: Node 24, pnpm 9.15 (pnpm install), CMake 3.22+ and Ninja.

  • Apple: Xcode with the Metal toolchain (xcodebuild -downloadComponent MetalToolchain if xcrun metal is missing).
  • Android: Android SDK and NDK (android-* presets).
  • Web: Emscripten (web-webgpu-debug preset; wipe build/ after upgrading it) and Chrome.
  • Linux: ninja-build pkg-config libwayland-dev wayland-protocols libvulkan-dev zlib1g-dev glslang-tools.
  • Coverage: gcovr; pnpm coverage fails below the floors in tools/coverage-baseline.json.

Using Glim

  • CMake: install a configured preset and find_package(glim). See tests/package.
  • Xcode: pnpm xcframework builds a Swift package. See apple.
  • Gradle: pnpm aar builds a prefab AAR. See android.
  • Web: pnpm web-pack packs @glim/web into build/web-pack/glim-web.tgz (publishing is a dry run). See packages/glim-web.

Frame-rate limits, crash reports and symbolization are in packages/glim-toolkit-host. Versioning and what counts as public API are in the changelog.

Contributions

Glim is maintained as a closed-contribution project. Pull requests are not accepted and will be closed without review. Bug reports and questions are welcome as issues, though a response is not guaranteed.

MIT · Volodymyr Lykhonis

About

Modular UI stack: swappable host, compositor, and toolkit for phones, TVs, cars, desktop, and web

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages