diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-18 09:19:03 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-18 09:19:03 +0200 |
| commit | d845cf3208c3bbdb7e3dd3041d1ae491b88d4d21 (patch) | |
| tree | 5fa93b7787a1f1c9598aecfc772ede6dbac17f8d /internal/display/hittest.go | |
| parent | 88f4e239a7521112a4db8c7842e3a05db4446cd4 (diff) | |
feat: add load average bar visualization (4/l hotkey)0.12.0
Adds a new teal bar type showing /proc/loadavg data per host.
The 1-min average fills from the top downward; yellow and white
1px reference lines mark the 5-min and 15-min averages. A global
loadPeak tracker (floor 2.0, slow per-frame decay) keeps the scale
meaningful across hosts and after spikes. Toggle with 4 or l;
persisted to ~/.loadbarsrc as showload=1.
Bump version to 0.12.0.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/display/hittest.go')
| -rw-r--r-- | internal/display/hittest.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/display/hittest.go b/internal/display/hittest.go index fe88471..fd2a218 100644 --- a/internal/display/hittest.go +++ b/internal/display/hittest.go @@ -13,6 +13,7 @@ const ( barCPU barKind = iota barMem barNet + barLoad ) // barDescriptor describes a single bar's position, host, and type. @@ -26,7 +27,7 @@ type barDescriptor struct { // buildBarMap replays the same host/bar iteration as drawBars to produce // a slice of bar descriptors with their screen rectangles. func buildBarMap(snap map[string]*stats.HostStats, cfg *config.Config, state *runState) []barDescriptor { - numBars := countBars(snap, state.cpuMode, state.showMem, state.showNet) + numBars := countBars(snap, state.cpuMode, state.showMem, state.showNet, state.showLoad) maxPerRow := cfg.MaxBarsPerRow hosts := sortedHosts(snap) @@ -66,6 +67,15 @@ func buildBarMap(snap map[string]*stats.HostStats, cfg *config.Config, state *ru }) barIndex++ } + if state.showLoad { + x, y, w, bh := barRect(state.winW, state.winH, numBars, maxPerRow, barIndex) + bars = append(bars, barDescriptor{ + host: host, + kind: barLoad, + rect: sdl.Rect{X: x, Y: y, W: w, H: bh}, + }) + barIndex++ + } } return bars } |
