Disk Monitor — monitor app
Disk Monitor is a monitor app built from LightGUI's XFrame monitor widgets. One 1024x768 window shows live disk usage and throughput: a usage bar per disk mount, a Used / Free stack bar for the largest mount, and a read/write history graph. Everything is live data — /proc/mounts + statvfs for usage, /proc/diskstats (sectors differenced once a second) for MB/s — refreshing every second.

Disk Monitor running — screenshot taken from the C version under Xvfb.
What it shows
- Per-mount usage bars — one bar per real on-disk filesystem (
ext4/xfs/btrfsfrom/proc/mounts), label with mount point and total size, percentage on the right. - Used / Free stack bar — the largest mount split into Used and Free in GiB, with a legend showing each share.
- Disk IO history graph — read MB/s and write MB/s over a 60-second window, with current / min / max / average per series.
Widgets used
- XUsageBar — one per mount:
set_value(pct)every tick. - XStackBar —
clear_segments()+add_segment("Used" / "Free", gib)every tick. - XHistoryGraph — seeded demo series cleared at startup (
clear_series()), thenpush(read, write)every second.
Why no XSysBox: it has no clear-history API and its constructor seeds 60 demo samples, so it cannot show live disk data without the seeded demo leaking into the history. XUsageBar + XHistoryGraph + XStackBar cover the same ground with live setters.
Build and run — C
cd examples/monitor/disk-monitor
make
./disk-monitorBuild recipe (same as the widget demo mains): g++ -std=c++17 -Iwidgets/components/XUsageBar -Iwidgets/components/XHistoryGraph -Iwidgets/components/XStackBar main.cpp -lX11. Esc / q / window-close quits.
Build and run — Rust
bash -lc "cargo run -p xframe-demo --example monitor_disk_monitor"Uses MonitorWidget kinds UsageBar / StackBar / HistoryGraph. Titles go in the construction name (StackBar/HistoryGraph headers draw state.name), and the history graph auto-ranges (state.max == state.min selects auto-range from the data, so IO spikes above 100 MB/s are not clipped).
Build and run — Python
PYTHONPATH=. python3 examples/monitor_disk_monitor/main.pyUses create('XUsageBar' / 'XStackBar' / 'XHistoryGraph', ...) with set_value(), set_segments() and push(value, series=N) on a 1-second GLib.timeout_add tick. The harness background is the widgets' near-black panel color — XStackBar paints no panel of its own. Close the window to quit.
App source
- C: examples/monitor/disk-monitor/main.cpp
- Rust: crates/xframe-demo/examples/monitor_disk_monitor/main.rs
- Python: examples/monitor_disk_monitor/main.py
Get the code
These widgets ship in all three LightGUI repos:
- lightgui (C)
- lightgui_rust (Rust)
- lightgui_python (Python)