summaryrefslogtreecommitdiff
path: root/internal/display/hittest.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/display/hittest.go')
-rw-r--r--internal/display/hittest.go12
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
}