mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
integrate widget order, toggling into global config and compact grid
This commit is contained in:
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/bcicen/ctop/logging"
|
||||
)
|
||||
@@ -10,17 +11,23 @@ import (
|
||||
var (
|
||||
GlobalParams []*Param
|
||||
GlobalSwitches []*Switch
|
||||
GlobalWidgets []*Widget
|
||||
lock sync.RWMutex
|
||||
log = logging.Init()
|
||||
)
|
||||
|
||||
func Init() {
|
||||
for _, p := range params {
|
||||
for _, p := range defaultParams {
|
||||
GlobalParams = append(GlobalParams, p)
|
||||
log.Infof("loaded config param: %s: %s", quote(p.Key), quote(p.Val))
|
||||
log.Infof("loaded default config param: %s: %s", quote(p.Key), quote(p.Val))
|
||||
}
|
||||
for _, s := range switches {
|
||||
for _, s := range defaultSwitches {
|
||||
GlobalSwitches = append(GlobalSwitches, s)
|
||||
log.Infof("loaded config switch: %s: %t", quote(s.Key), s.Val)
|
||||
log.Infof("loaded default config switch: %s: %t", quote(s.Key), s.Val)
|
||||
}
|
||||
for _, w := range defaultWidgets {
|
||||
GlobalWidgets = append(GlobalWidgets, w)
|
||||
log.Infof("loaded default widget: %s: %t", quote(w.Name), w.Enabled)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user