mirror of
https://github.com/taigrr/wtf
synced 2026-03-27 13:42:21 -07:00
WTF-482 Sanity-check position configuration data for modules
If a module is missing any of the positional data it now informs the user and exits gracefully with an error.
This commit is contained in:
@@ -30,12 +30,12 @@ type Module struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
type Position struct {
|
||||
Height int
|
||||
Left int
|
||||
Top int
|
||||
Width int
|
||||
}
|
||||
// type Position struct {
|
||||
// Height int
|
||||
// Left int
|
||||
// Top int
|
||||
// Width int
|
||||
// }
|
||||
|
||||
type Sigils struct {
|
||||
Checkbox struct {
|
||||
@@ -64,7 +64,7 @@ type Common struct {
|
||||
|
||||
func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
|
||||
colorsConfig, _ := globalSettings.Get("wtf.colors")
|
||||
positionPath := "position"
|
||||
// positionPath := "position"
|
||||
sigilsPath := "wtf.sigils"
|
||||
|
||||
common := Common{
|
||||
@@ -86,12 +86,7 @@ func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config
|
||||
Type: moduleConfig.UString("type", name),
|
||||
},
|
||||
|
||||
Position: Position{
|
||||
Height: moduleConfig.UInt(positionPath + ".height"),
|
||||
Left: moduleConfig.UInt(positionPath + ".left"),
|
||||
Top: moduleConfig.UInt(positionPath + ".top"),
|
||||
Width: moduleConfig.UInt(positionPath + ".width"),
|
||||
},
|
||||
Position: NewPositionFromYAML(name, moduleConfig),
|
||||
|
||||
Enabled: moduleConfig.UBool("enabled", false),
|
||||
RefreshInterval: moduleConfig.UInt("refreshInterval", 300),
|
||||
|
||||
Reference in New Issue
Block a user