diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-18 09:00:35 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-18 09:00:35 +0200 |
| commit | 88f4e239a7521112a4db8c7842e3a05db4446cd4 (patch) | |
| tree | 8c331f9f2e23ad9c9319d6dc8275205b23ce811a /internal/constants | |
| parent | 11204092b5ab5dc0f71515adfcaa6f07111363e5 (diff) | |
feat: triple-toggle CPU display mode via 1 key; add tooltip, font, hit-test
CPU display now cycles through three states with each press of 1:
0 = CPUModeAverage – aggregate bar only (default)
1 = CPUModeCores – individual core bars + aggregate
2 = CPUModeOff – all CPU bars hidden
Config file stores cpumode=N (integer); old showcores=0/1 is read for
backward compatibility. CLI flag --showcores replaced by --cpumode.
Other improvements landed in this commit:
- internal/display: add font.go (text rendering), hittest.go (bar hit
testing), tooltip.go (mouse-over tooltip), tooltip_test.go
- internal/display: mouse tracking and drawOverlay hook in display.go
- internal/display: update build tags to //go:build form
- internal/collector: embed remote script via script_embed.go /
scriptdata/loadbars-remote.sh
- internal/collector: CPULine.Total() changed to value receiver
- internal/collector: table test improvements (name field, t.Run)
- internal/constants: BytesPerSec consts promoted from var to const
- Magefile.go: fix error formatting and install path
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/constants')
| -rw-r--r-- | internal/constants/constants.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 0022621..e2a4fcb 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -16,6 +16,14 @@ const ( UserYellowThreshold = 50 // CPU user % for dark yellow ) +// CPUMode controls which CPU bars are displayed (cycles with the 1 key). +const ( + CPUModeAverage = 0 // Show only the aggregate CPU bar (default) + CPUModeCores = 1 // Show individual core bars plus the aggregate + CPUModeOff = 2 // Hide all CPU bars entirely + CPUModeCount = 3 // Total number of CPU modes for cycling +) + // Exit codes const ( Success = 0 @@ -52,7 +60,7 @@ var ( ) // BytesPerSec for link speed reference (bytes per second at given mbit) -var ( +const ( BytesMbit = 125000 Bytes10Mbit = 1250000 Bytes100Mbit = 12500000 |
