diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-18 14:14:52 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-18 14:14:52 +0200 |
| commit | f7887117c5269ed0336cc058c78c4b222e0e6b34 (patch) | |
| tree | 53e9c4b5163b29b0987beda78572ecdb13c31cf0 /internal/config | |
| parent | 69f5017434298f1ffd4cdc30c30b95d0f4bd344f (diff) | |
feat: add disk I/O stats (read/write throughput bars, hotkey 5, auto-scale)
Add a new disk stats category that reads /proc/diskstats, shows read/write
throughput as colored bars (purple/darker purple like network RX/TX), with
optional utilization % overlay in extended mode. Hotkey 5 cycles: aggregate
(sum all whole-disk devices) → per-device → off. Auto-scale with decay and
optional fixed override via --diskmax / diskmax config key.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index d9b367c..1df8edd 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -32,6 +32,9 @@ type Config struct { ShowLoad bool LoadMax float64 // 0 = auto-scale; >0 = fixed full-height reference value ShowSeparators bool + DiskMode int // constants.DiskModeAggregate / DiskModeDevices / DiskModeOff + DiskMax float64 // 0 = auto-scale; >0 = fixed bytes/sec reference + DiskAverage int // smoothing sample count (like CPUAverage/NetAverage) MaxBarsPerRow int SSHOpts string Cluster string @@ -51,6 +54,9 @@ func Default() Config { CPUMode: constants.CPUModeAverage, // start with aggregate bar only ShowMem: false, ShowNet: false, + DiskMode: constants.DiskModeOff, + DiskMax: 0, + DiskAverage: 10, MaxBarsPerRow: 0, } } @@ -112,6 +118,7 @@ func (c *Config) parseReader(f *os.File) error { "hasagent": true, "height": true, "maxwidth": true, "netaverage": true, "netlink": true, "cpumode": true, "showcores": true, "showmem": true, "showavgline": true, "showioavgline": true, "shownet": true, "showload": true, "loadmax": true, "showseparators": true, + "diskmode": true, "diskmax": true, "diskaverage": true, "maxbarsperrow": true, "sshopts": true, "cluster": true, } scanner := bufio.NewScanner(f) @@ -217,6 +224,20 @@ func (c *Config) setDisplayFlags(key, val string) { } case "showseparators": c.ShowSeparators = parseBool(val) + case "diskmode": + // 0=aggregate, 1=devices, 2=off — clamp to valid range + if n, err := strconv.Atoi(val); err == nil && n >= 0 && n < constants.DiskModeCount { + c.DiskMode = n + } + case "diskmax": + // Accept any non-negative float; 0 means auto-scale. + if f, err := strconv.ParseFloat(val, 64); err == nil && f >= 0 { + c.DiskMax = f + } + case "diskaverage": + if n, err := strconv.Atoi(val); err == nil && n > 0 { + c.DiskAverage = n + } } } @@ -249,6 +270,9 @@ func (c *Config) writeTo(f *os.File) error { writeBool("showload", c.ShowLoad) writeFloat("loadmax", c.LoadMax) writeBool("showseparators", c.ShowSeparators) + writeInt("diskmode", c.DiskMode) + writeFloat("diskmax", c.DiskMax) + writeInt("diskaverage", c.DiskAverage) writeInt("maxbarsperrow", c.MaxBarsPerRow) writeStr("sshopts", c.SSHOpts) writeStr("cluster", c.Cluster) |
