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

WTF-400 Partial conversion to new Common settings

This commit is contained in:
Chris Cummer
2019-04-18 19:02:08 -07:00
parent f09d08bda2
commit 59f0bc6cfc
8 changed files with 89 additions and 49 deletions

View File

@@ -28,10 +28,16 @@ type Position struct {
Width int
}
type Sigils struct {
CheckedIcon string
UncheckedIcon string
}
type Common struct {
Colors
Module
Position
Sigils
Enabled bool
FocusChar int
@@ -43,6 +49,7 @@ func NewCommonSettingsFromYAML(name, configKey string, ymlConfig *config.Config)
colorsPath := "wtf.colors"
modulePath := "wtf.mods." + configKey
positionPath := "wtf.mods." + configKey + ".position"
sigilsPath := "wtf.sigils"
common := Common{
Colors: Colors{
@@ -50,7 +57,7 @@ func NewCommonSettingsFromYAML(name, configKey string, ymlConfig *config.Config)
BorderFocusable: ymlConfig.UString(colorsPath+".border.focusable", "red"),
BorderFocused: ymlConfig.UString(colorsPath+".border.focused", "orange"),
BorderNormal: ymlConfig.UString(colorsPath+".border.normal", "gray"),
Checked: ymlConfig.UString(colorsPath+".checked", "gray"),
Checked: ymlConfig.UString(colorsPath+".checked", "white"),
HighlightFore: ymlConfig.UString(colorsPath+".highlight.fore", "black"),
HighlightBack: ymlConfig.UString(colorsPath+".highlight.back", "green"),
Text: ymlConfig.UString(modulePath+".colors.text", ymlConfig.UString(colorsPath+".text", "white")),
@@ -69,6 +76,11 @@ func NewCommonSettingsFromYAML(name, configKey string, ymlConfig *config.Config)
Width: ymlConfig.UInt(positionPath + ".width"),
},
Sigils: Sigils{
CheckedIcon: ymlConfig.UString(sigilsPath+".checkedIcon", "x"),
UncheckedIcon: ymlConfig.UString(sigilsPath+".uncheckedIcon", " "),
},
Enabled: ymlConfig.UBool(modulePath+".enabled", false),
FocusChar: ymlConfig.UInt(modulePath+".focusChar", -1),
RefreshInterval: ymlConfig.UInt(modulePath+".refreshInterval", 300),