1024x768 window, 1 s refresh from /proc/mounts + os.statvfs and /proc/diskstats. XUsageBar + XStackBar + XHistoryGraph; seeded demo data replaced on first tick (push/set_segments start fresh own data). Harness background is the widgets near-black panel color (XStackBar paints no panel of its own). XSysBox deliberately unused (no clear-history API, constructor seeds 60 demo samples). Screenshot verified 1024x768 on :116. Tests: 363 OK.
Disk Monitor — Python (XFrame)
A live disk monitor in one 1024x768 window: per-mount usage bars,
a Used / Free stack bar for the largest mount, and a read/write
throughput history graph. All data is live — /proc/mounts +
os.statvfs for usage, /proc/diskstats (sectors differenced once
a second) for MB/s. Refreshes every second via GLib.timeout_add;
close the window to quit.
Widgets used
| Widget | Role |
|---|---|
| XUsageBar | One per disk mount: usage % with total size |
| XStackBar | Largest mount split into Used / Free (GiB) |
| XHistoryGraph | Read MB/s + Write MB/s history, 60 s window |
Seeded demo series/segments are replaced by live data on the first
tick (push() / set_segments() start fresh own data, never the
demo). The harness background is the widgets' near-black panel color
— XStackBar paints no panel of its own, so a white background would
wash its light-grey legend out. Note the Python XStackBar draws no
title (its draw ignores the label prop); the C/Rust ports show
"/ disk usage" there.
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.
Build & run
PYTHONPATH=/root/monitor-wt/disk-monitor/lightgui_python python3 examples/monitor_disk_monitor/main.py
Screenshot
Source
- App:
examples/monitor_disk_monitor/main.py - Repo: https://github.com/cnmcdee/lightgui_python
- C port:
examples/monitor/disk-monitor/main.cppin https://github.com/cnmcdee/lightgui - Rust port:
crates/xframe-demo/examples/monitor_disk_monitor/main.rsin https://github.com/cnmcdee/lightgui_rust
