1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Further reduce usage of global

Bargraph moves to common settings
"Global" config moves out of wtf and into cfg for the few things that need it
We can probably eliminate a global config used across things if we want to
This commit is contained in:
Sean Smith
2019-04-27 15:08:02 -04:00
parent 5abd701b40
commit bcf899df72
13 changed files with 67 additions and 52 deletions

View File

@@ -56,6 +56,7 @@ type Common struct {
Enabled bool
RefreshInterval int
Title string
Config *config.Config
focusChar int
}
@@ -93,6 +94,7 @@ func NewCommonSettingsFromModule(name string, moduleConfig *config.Config, globa
Enabled: moduleConfig.UBool("enabled", false),
RefreshInterval: moduleConfig.UInt("refreshInterval", 300),
Title: moduleConfig.UString("title", name),
Config: moduleConfig,
focusChar: moduleConfig.UInt("focusChar", -1),
}

View File

@@ -17,6 +17,8 @@ const ConfigDirV1 = "~/.wtf/"
// ConfigDirV2 defines the path to the second version of the configuration. Use this.
const ConfigDirV2 = "~/.config/wtf/"
var Config *config.Config
/* -------------------- Config Migration -------------------- */
// MigrateOldConfig copies any existing configuration from the old location
@@ -130,6 +132,7 @@ func LoadConfigFile(filePath string) *config.Config {
fmt.Printf(" %s\n", err.Error())
os.Exit(1)
}
Config = cfg
return cfg
}