summaryrefslogtreecommitdiff
path: root/internal/display/display.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/display/display.go')
-rw-r--r--internal/display/display.go31
1 files changed, 25 insertions, 6 deletions
diff --git a/internal/display/display.go b/internal/display/display.go
index 54c5c51..d3f27ca 100644
--- a/internal/display/display.go
+++ b/internal/display/display.go
@@ -25,8 +25,9 @@ type runState struct {
showIOAvgLine bool
showCores bool
showMem bool
- showNet bool
- extended bool
+ showNet bool
+ showSeparators bool
+ extended bool
winW int32
winH int32
prevCPU map[string]collector.CPULine
@@ -44,8 +45,9 @@ func newRunState(cfg *config.Config, winW, winH int32) *runState {
showIOAvgLine: cfg.ShowIOAvgLine,
showCores: cfg.ShowCores,
showMem: cfg.ShowMem,
- showNet: cfg.ShowNet,
- extended: cfg.Extended,
+ showNet: cfg.ShowNet,
+ showSeparators: cfg.ShowSeparators,
+ extended: cfg.Extended,
winW: winW,
winH: winH,
prevCPU: make(map[string]collector.CPULine),
@@ -160,6 +162,9 @@ func handleKey(sym sdl.Keycode, window *sdl.Window, cfg *config.Config, state *r
case sdl.K_i:
state.showIOAvgLine = !state.showIOAvgLine
fmt.Println("==> Toggled global I/O avg line:", state.showIOAvgLine)
+ case sdl.K_s:
+ state.showSeparators = !state.showSeparators
+ fmt.Println("==> Toggled host separators:", state.showSeparators)
case sdl.K_a:
cfg.CPUAverage++
fmt.Println("==> CPU average samples:", cfg.CPUAverage)
@@ -188,6 +193,7 @@ func handleKey(sym sdl.Keycode, window *sdl.Window, cfg *config.Config, state *r
cfg.ShowCores = state.showCores
cfg.ShowMem = state.showMem
cfg.ShowNet = state.showNet
+ cfg.ShowSeparators = state.showSeparators
cfg.Extended = state.extended
if err := cfg.Write(); err != nil {
fmt.Fprintf(os.Stderr, "!!! Write config: %v\n", err)
@@ -271,12 +277,25 @@ func countBars(snap map[string]*stats.HostStats, showCores, showMem, showNet boo
// drawBars draws CPU, memory, and network bars for all hosts in snap.
func drawBars(renderer *sdl.Renderer, snap map[string]*stats.HostStats, cfg *config.Config, state *runState, numBars int) {
barIndex := 0
- for _, host := range sortedHosts(snap) {
+ hosts := sortedHosts(snap)
+ // Track where each host's bars end so we can draw separators after all bars
+ var separatorXs []int32
+ for i, host := range hosts {
h := snap[host]
if h == nil {
continue
}
drawHostBars(renderer, h, host, cfg, state, numBars, &barIndex)
+ // Record separator position between hosts (not after the last one)
+ if state.showSeparators && i < len(hosts)-1 {
+ sepX, _ := barBounds(state.winW, numBars, barIndex)
+ separatorXs = append(separatorXs, sepX)
+ }
+ }
+ // Draw 1px yellow vertical separators on top of all bars
+ for _, sepX := range separatorXs {
+ renderer.SetDrawColor(constants.Yellow.R, constants.Yellow.G, constants.Yellow.B, 255)
+ renderer.FillRect(&sdl.Rect{X: sepX, Y: 0, W: 1, H: state.winH})
}
}
@@ -611,7 +630,7 @@ func drawMemBarSmoothed(renderer *sdl.Renderer, h *stats.HostStats, smoothed *st
}
func printHotkeys() {
- fmt.Println("=> Hotkeys: 1=cores 2/m=mem 3/n=net e=extended g=avg line i=io avg h=help q=quit w=write config a/y=cpu avg d/c=net avg f/v=link scale arrows=resize")
+ fmt.Println("=> Hotkeys: 1=cores 2/m=mem 3/n=net e=extended g=avg line i=io avg s=separators h=help q=quit w=write config a/y=cpu avg d/c=net avg f/v=link scale arrows=resize")
}
t'>24
-rw-r--r--0.2.2/UPDATES.txt22
-rw-r--r--0.2.2/bar.gifbin0 -> 231 bytes-rw-r--r--0.2.2/config.pm313
-rw-r--r--0.2.2/help_html616
-rw-r--r--0.2.2/htdocs.pl223
-rw-r--r--0.2.2/index.pl354
-rw-r--r--0.2.2/logs_html391
-rw-r--r--0.2.2/main.pl497
-rw-r--r--0.2.2/main2.pl502
-rw-r--r--0.2.2/online.pl52
-rw-r--r--0.2.2/push.pl85
-rw-r--r--0.2.2/unten.gifbin0 -> 662 bytes-rw-r--r--0.2.2/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.2.3/INDEX.PL354
-rw-r--r--0.2.3/INSTALL.txt104
-rw-r--r--0.2.3/LIESMICH.txt24
-rw-r--r--0.2.3/UPDATES.txt31
-rw-r--r--0.2.3/bar.gifbin0 -> 231 bytes-rw-r--r--0.2.3/config.pm321
-rw-r--r--0.2.3/help_html616
-rw-r--r--0.2.3/htdocs.pl222
-rw-r--r--0.2.3/logs_html391
-rw-r--r--0.2.3/main.pl497
-rw-r--r--0.2.3/main2.pl513
-rw-r--r--0.2.3/online.pl52
-rw-r--r--0.2.3/push.pl93
-rw-r--r--0.2.3/setup.sh42
-rw-r--r--0.2.3/unten.gifbin0 -> 662 bytes-rw-r--r--0.2.3/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.2.3/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.2.4a/INSTALL.txt107
-rw-r--r--0.2.4a/LIESMICH.txt33
-rw-r--r--0.2.4a/TODO.txt32
-rw-r--r--0.2.4a/UPDATES.txt43
-rw-r--r--0.2.4a/bar.gifbin0 -> 231 bytes-rw-r--r--0.2.4a/config.pm321
-rw-r--r--0.2.4a/help_html616
-rw-r--r--0.2.4a/htdocs.pl222
-rw-r--r--0.2.4a/index.pl354
-rw-r--r--0.2.4a/logs_html391
-rw-r--r--0.2.4a/main.pl498
-rw-r--r--0.2.4a/main2.pl513
-rw-r--r--0.2.4a/online.pl52
-rw-r--r--0.2.4a/push.pl96
-rw-r--r--0.2.4a/setup.sh42
-rw-r--r--0.2.4a/unten.gifbin0 -> 662 bytes-rw-r--r--0.2.4a/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.2.4a/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.2.4c/INSTALL.txt107
-rw-r--r--0.2.4c/LIESMICH.txt33
-rw-r--r--0.2.4c/UPDATES.txt43
-rw-r--r--0.2.4c/bar.gifbin0 -> 231 bytes-rw-r--r--0.2.4c/config.pm321
-rw-r--r--0.2.4c/help_html616
-rw-r--r--0.2.4c/htdocs.pl222
-rw-r--r--0.2.4c/index.pl354
-rw-r--r--0.2.4c/logs_html391
-rw-r--r--0.2.4c/main.pl560
-rw-r--r--0.2.4c/main2.pl561
-rw-r--r--0.2.4c/online.pl52
-rw-r--r--0.2.4c/push.pl96
-rw-r--r--0.2.4c/setup.sh42
-rw-r--r--0.2.4c/unten.gifbin0 -> 662 bytes-rw-r--r--0.2.4c/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.2.4c/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.2.5a2/INSTALL.txt103
-rw-r--r--0.2.5a2/LIESMICH.txt45
-rw-r--r--0.2.5a2/TODO.txt27
-rw-r--r--0.2.5a2/UPDATES.txt75
-rw-r--r--0.2.5a2/bar.gifbin0 -> 231 bytes-rw-r--r--0.2.5a2/config.pm320
-rw-r--r--0.2.5a2/help.sno54
-rw-r--r--0.2.5a2/htdocs.pl206
-rw-r--r--0.2.5a2/index.pl368
-rw-r--r--0.2.5a2/main.pl633
-rw-r--r--0.2.5a2/main2.pl571
-rw-r--r--0.2.5a2/online.pl56
-rw-r--r--0.2.5a2/push.pl97
-rw-r--r--0.2.5a2/setup.sh40
-rw-r--r--0.2.5a2/unten.gifbin0 -> 662 bytes-rw-r--r--0.2.5a2/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.2.5a2/yBanner2.gifbin0 -> 2105 bytes-rw-r--r--0.2.5a2/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.2.6a/INSTALL.txt106
-rw-r--r--0.2.6a/LIESMICH.txt45
-rw-r--r--0.2.6a/TODO.txt25
-rw-r--r--0.2.6a/UPDATES.txt91
-rw-r--r--0.2.6a/bar.gifbin0 -> 231 bytes-rw-r--r--0.2.6a/config.pm321
-rw-r--r--0.2.6a/help.sno54
-rw-r--r--0.2.6a/htdocs.pl208
-rw-r--r--0.2.6a/index.pl369
-rw-r--r--0.2.6a/main.pl698
-rw-r--r--0.2.6a/main2.pl571
-rw-r--r--0.2.6a/online.pl56
-rw-r--r--0.2.6a/push.pl105
-rw-r--r--0.2.6a/setup.sh42
-rw-r--r--0.2.6a/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.2.6a/yBanner2.gifbin0 -> 2105 bytes-rw-r--r--0.2.6a/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.4.0a/INSTALL.txt107
-rw-r--r--0.4.0a/LIESMICH.txt45
-rw-r--r--0.4.0a/TODO.txt24
-rw-r--r--0.4.0a/UPDATES.txt102
-rw-r--r--0.4.0a/bar.gifbin0 -> 231 bytes-rw-r--r--0.4.0a/config.pm307
-rw-r--r--0.4.0a/help.sno56
-rw-r--r--0.4.0a/htdocs.pl195
-rw-r--r--0.4.0a/index.pl373
-rw-r--r--0.4.0a/main.pl739
-rw-r--r--0.4.0a/main2.pl576
-rw-r--r--0.4.0a/online.pl72
-rw-r--r--0.4.0a/push.pl97
-rw-r--r--0.4.0a/setup.sh42
-rw-r--r--0.4.0a/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.4.0a/yBanner2.gifbin0 -> 2105 bytes-rw-r--r--0.4.0a/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.4.1/INSTALL.txt107
-rw-r--r--0.4.1/LIESMICH.txt45
-rw-r--r--0.4.1/TODO.txt24
-rw-r--r--0.4.1/UPDATES.txt111
-rw-r--r--0.4.1/bar.gifbin0 -> 231 bytes-rw-r--r--0.4.1/colors.sno290
-rw-r--r--0.4.1/config.pm306
-rw-r--r--0.4.1/help.sno55
-rw-r--r--0.4.1/htdocs.pl195
-rw-r--r--0.4.1/index.pl376
-rw-r--r--0.4.1/main.pl737
-rw-r--r--0.4.1/main2.pl568
-rw-r--r--0.4.1/online.pl72
-rw-r--r--0.4.1/push.pl97
-rw-r--r--0.4.1/setup.sh42
-rw-r--r--0.4.1/yBanner.gifbin0 -> 5185 bytes-rw-r--r--0.4.1/yBanner2.gifbin0 -> 2105 bytes-rw-r--r--0.4.1/yChat.jpgbin0 -> 50407 bytes-rw-r--r--0.4.2/CREDITS.txt26
-rw-r--r--0.4.2/README.txt33
-rw-r--r--0.4.2/SETUP.txt102
-rw-r--r--0.4.2/TODO.txt24
-rw-r--r--0.4.2/UPDATES.txt119
-rw-r--r--0.4.2/colors.sno290
-rw-r--r--0.4.2/config.pm307
-rw-r--r--0.4.2/help.sno55
-rw-r--r--0.4.2/htdocs.pl244
-rw-r--r--0.4.2/index.pl392
-rw-r--r--0.4.2/main.pl798
-rw-r--r--