From 1e2616848aaa9ffba2663dcb10bab576fbdbae6e Mon Sep 17 00:00:00 2001 From: Markus Zehnder Date: Tue, 16 Sep 2025 21:12:31 +0200 Subject: [PATCH] refactor: separate unit in temperature sensors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not append the `°C` unit to temperature sensors. Add the unit in a separate label key with `#unit` suffix. This allows filtering out the unit label if the panel has a graphical representation of the unit. --- crates/aster-sysinfo/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/aster-sysinfo/src/main.rs b/crates/aster-sysinfo/src/main.rs index adf31d8..21515d9 100644 --- a/crates/aster-sysinfo/src/main.rs +++ b/crates/aster-sysinfo/src/main.rs @@ -401,8 +401,8 @@ impl SysinfoSource { // component.label(), component.type_id(), component.id()); } - // TODO add unit as a separate sensor? - add_sensor(sensors, label, format!("{temperature:.1} °C")); + add_sensor(sensors, format!("{label}#unit"), "°C"); + add_sensor(sensors, label, format!("{temperature:.1}")); } }