panel: add spacing option

parent d748843c
......@@ -67,6 +67,14 @@ Optional monitor filter:
An empty or missing `output` list leaves Waybar on its default outputs.
Module spacing:
```json
{
"spacing": 10
}
```
## Module Resolution
The config stores logical module names. At generation time, the panel merges
......
......@@ -2,6 +2,7 @@
"position": "top",
"type": "panel",
"output": [],
"spacing": 10,
"modules_left": [
"image#menu",
"tray"
......
......@@ -21,6 +21,7 @@ type Config struct {
Position string `json:"position"`
Type string `json:"type"`
Output []string `json:"output"`
Spacing int `json:"spacing"`
ModulesLeft []string `json:"modules_left"`
ModulesCenter []string `json:"modules_center"`
ModulesRight []string `json:"modules_right"`
......@@ -83,6 +84,10 @@ func (c Config) Validate() error {
}
}
if c.Spacing < 0 {
return errors.New("spacing cannot be negative")
}
for _, name := range append(append([]string{}, c.ModulesLeft...), append(c.ModulesCenter, c.ModulesRight...)...) {
if strings.TrimSpace(name) == "" {
return errors.New("module name cannot be empty")
......
......@@ -14,7 +14,7 @@ func GenerateConfig(cfg Config, registry Registry) ([]byte, error) {
"margin-top": 0,
"margin-right": 0,
"margin-bottom": 0,
"spacing": 10,
"spacing": cfg.Spacing,
"exclusive": true,
"fixed-center": true,
"reload_style_on_change": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment