From bec52620192c4fe3e3ff238d014811ea8d3fa252 Mon Sep 17 00:00:00 2001 From: Sisyphus Agent Date: Tue, 7 Jul 2026 14:54:41 +0300 Subject: [PATCH] redbear-power: show load average in header Add a "Load: 0.42 0.55 0.61" line to render_header, color-coded by load versus core count (green <= 50% capacity, yellow <= 100%, red overcommitted). Bump HEADER_LINES from 7 to 8. Build, 224 tests, clippy, and fmt clean. --- .../system/redbear-power/source/src/render.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/local/recipes/system/redbear-power/source/src/render.rs b/local/recipes/system/redbear-power/source/src/render.rs index 6686412269..185af74059 100644 --- a/local/recipes/system/redbear-power/source/src/render.rs +++ b/local/recipes/system/redbear-power/source/src/render.rs @@ -30,7 +30,7 @@ use crate::cpuid; use crate::graph::BrailleGraph; use crate::theme::{self, Theme}; -pub const HEADER_LINES: u16 = 7; +pub const HEADER_LINES: u16 = 8; pub const KEYBAR_LINES: u16 = 1; pub const TAB_BAR_LINES: u16 = 1; pub const GRAPH_HEIGHT: u16 = 6; @@ -268,6 +268,24 @@ pub fn render_header<'a>(app: &'a App, focused: bool) -> Paragraph<'a> { app.hybrid_summary.as_str().set_style(theme.value_hot) }, ]), + Line::from(vec![ + "Load: ".set_style(theme.label), + match app.load_avg { + Some((a, b, c)) => { + let cores = app.cpus.len().max(1) as f64; + let one_minute = a.max(b).max(c); + let style = if one_minute >= cores { + theme.value_hot + } else if one_minute >= cores * 0.5 { + theme.value_warm + } else { + theme.value_ok + }; + format!("{a:.2} {b:.2} {c:.2}").set_style(style) + } + None => "n/a".set_style(theme.value_off), + }, + ]), Line::from(vec![ "Daemons: ".set_style(theme.label), "cpufreqd=".set_style(theme.value_off),