XLoadBadge
XLoadBadge is a Monitor widget in LightGUI's XFrame widget set. Load-average badge (1/5/15 min) with colour thresholds and uptime.
XLoadBadge is the small header badge: the 1-, 5- and 15-minute load averages with colour thresholds, plus the system uptime. It reads /proc/loadavg and /proc/uptime itself, so there is nothing to feed it — construct it, draw it, and it stays current.

Key methods
set_text(t)— the badge label
Every widget also gets the shared properties visible, enabled, bounds (x, y, width, height) and style_name, plus the background / foreground colours from the active style.
Example
No feeding needed: the badge reads the load averages and uptime on its own.
XLoadBadge widget(display, screen, window, gc, &styles, 20, 20, 320, 80);
widget.draw(); // reads /proc/loadavg + /proc/uptime itself
The snippet above is the widget part only. As with every XFrame example, the full program opens a display, creates a window and a style manager, then runs the standard event loop — see the complete example in the repo.
Build it from the repo root:
g++ -std=c++17 -Iwidgets/components -Iwidgets examples/XLoadBadge.cpp -lX11 -o XLoadBadgeRun it under Xvfb or a real X server; close the window to quit.
Example in the repo
The full working example is examples/XLoadBadge.cpp in the lightgui repo (C is canonical). The same widget is ported to the Rust and Python repos under the same name — see the links below.
Get the code
These widgets ship in all three LightGUI repos:
- lightgui (C)
- lightgui_rust (Rust)
- lightgui_python (Python)