summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-17 18:49:45 +0200
committerPaul Buetow <paul@buetow.org>2026-02-17 18:49:45 +0200
commit362e3e8112ad36d21bd570aa062e9f7185a8b9e9 (patch)
tree0d7d452bd6a7451d25b6c5064ffeb29bc8505254 /internal/config
parentc680422366d7a4fc358917b8c8af5dd5bae792ae (diff)
Add multi-row bar layout with maxbarsperrow config option
When monitoring many servers, bars can become too thin to read. The new maxbarsperrow setting (default 0 = unlimited) wraps bars into multiple rows of equal height when the count exceeds the limit. The last row may have fewer, wider bars filling the full window width. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 9daf6d2..ba7886e 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -30,6 +30,7 @@ type Config struct {
ShowMem bool
ShowNet bool
ShowSeparators bool
+ MaxBarsPerRow int
SSHOpts string
Cluster string
}
@@ -45,9 +46,10 @@ func Default() Config {
MaxWidth: 1900,
NetAverage: 15,
NetLink: "gbit",
- ShowCores: false,
- ShowMem: false,
- ShowNet: false,
+ ShowCores: false,
+ ShowMem: false,
+ ShowNet: false,
+ MaxBarsPerRow: 0,
}
}
@@ -108,7 +110,7 @@ func (c *Config) parseReader(f *os.File) error {
"hasagent": true, "height": true, "maxwidth": true, "netaverage": true,
"netlink": true, "showcores": true, "showmem": true,
"showavgline": true, "showioavgline": true, "shownet": true, "showseparators": true,
- "sshopts": true, "cluster": true,
+ "maxbarsperrow": true, "sshopts": true, "cluster": true,
}
scanner := bufio.NewScanner(f)
for scanner.Scan() {
@@ -175,6 +177,10 @@ func (c *Config) set(key, val string) {
c.ShowNet = parseBool(val)
case "showseparators":
c.ShowSeparators = parseBool(val)
+ case "maxbarsperrow":
+ if n, err := strconv.Atoi(val); err == nil {
+ c.MaxBarsPerRow = n
+ }
case "sshopts":
c.SSHOpts = val
case "cluster":
@@ -207,6 +213,7 @@ func (c *Config) writeTo(f *os.File) error {
writeBool("showmem", c.ShowMem)
writeBool("shownet", c.ShowNet)
writeBool("showseparators", c.ShowSeparators)
+ writeInt("maxbarsperrow", c.MaxBarsPerRow)
writeStr("sshopts", c.SSHOpts)
writeStr("cluster", c.Cluster)
return w.Flush()