Temperature Monitor — monitor app

Temperature Monitor — monitor app

Temperature Monitor is the btop-style monitor app for CPU temperature, built from LightGUI's XFrame monitor widgets: a single XTempHistory in one 1024x768 window, showing the first thermal zone's temperature history with an 80 C threshold line. Everything on screen is a widget from the registry — no hand-drawn controls — fed live data from /sys/class/thermal/thermal_zone*/temp and /sys/class/hwmon/hwmon*/temp*_input, re-scanned every 2 s.

What it shows

  • Temperature history — the first thermal zone's readings over time, with current / min / max in the legend.
  • 80 C threshold line — a dashed red line; readings above it draw red.
  • Honest empty state — on a machine with no thermal sensors the graph stays empty, the legend reads “no data”, and the title says no thermal zones were found. No mock temperatures, no demo curve.
  • Rescan — sysfs is re-scanned every 2 s, so sensors that appear later (e.g. on a machine that has them) are picked up and the history starts filling with live readings.

No sensors on this machine

The screenshot above was taken on hot_dallas, a VPS with no thermal sensors at all: /sys/class/thermal/ holds only cooling devices, there are no thermal_zone*/temp files, /sys/class/hwmon/ is empty, and sensors is not installed. That is the whole point of this app's screenshot — it shows what the monitor honestly looks like with nothing to measure. The widget preloads a seeded demo ramp, so the app drops it at startup with the new additive XTempHistory::clear() (C), MonitorWidget::clear() (Rust, Python); later push() calls fill the series again as usual.

Widgets used

  • XTempHistory — temperature history with threshold line and current / min / max legend

Build and run — C

git clone https://git.lightgui.com/thinkmelt/lightgui.git
cd lightgui/examples/monitor/temperature-monitor
make
./temperature-monitor

Source: examples/monitor/temperature-monitor/main.cpp in the lightgui repo (C).

Build and run — Rust

git clone https://git.lightgui.com/thinkmelt/lightgui_rust.git
cd lightgui_rust
cargo run -p xframe-demo --example monitor_temperature_monitor

Source: crates/xframe-demo/examples/monitor_temperature_monitor/main.rs in the lightgui_rust repo (Rust).

Build and run — Python

git clone https://git.lightgui.com/thinkmelt/lightgui_python.git
cd lightgui_python
PYTHONPATH=. python3 examples/monitor_temperature_monitor/main.py

Source: examples/monitor_temperature_monitor/main.py in the lightgui_python repo (Python).

Esc, q, or closing the window quits in all three versions. The C screenshot above is the doc feature image; each language's own screenshot is committed next to its source.

Get the code

Linux Rocks Every Day
Source code: LightGUI (C) · LightGUI (Rust) · LightGUI (Python)