Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Preserve old CPU widget behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Jul 31, 2018
1 parent 12527db commit 813c239
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var (
zoom = 7
zoomInterval = 3

averageLoad = true
percpuLoad = true
averageLoad = false
percpuLoad = false

cpu *w.CPU
mem *w.Mem
Expand Down
8 changes: 8 additions & 0 deletions src/widgets/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ func NewCPU(interval time.Duration, zoom int, average bool, percpu bool) *CPU {
self.Label = "CPU Usage"
self.Zoom = zoom

if !(self.Average || self.PerCPU) {
if self.Count <= 8 {
self.PerCPU = true
} else {
self.Average = true
}
}

if self.Average {
self.Data["Average"] = []float64{0}
}
Expand Down

0 comments on commit 813c239

Please sign in to comment.