diff --git a/config.go b/config.go
index ffe6b37..ba7b758 100644
--- a/config.go
+++ b/config.go
@@ -7,6 +7,7 @@ import (
"log"
"os"
"path/filepath"
+ "regexp"
"github.com/adrg/xdg"
"github.com/hjson/hjson-go"
@@ -20,18 +21,96 @@ type MyConfig struct {
// Default background color
Background string `json:"background,omitempty"`
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+
// LA Plugin
- LA bool `json:"la,omitempty"`
+ LA struct {
+ Enabled bool `json:"enabled,omitempty"`
+
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+ } `json:"la,omitempty"`
Mem struct {
Enabled bool `json:"enabled,omitempty"`
ShowSwap bool `json:"show_swap,omitempty"`
+
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
} `json:"mem,omitempty"`
Clock struct {
Enabled bool `json:"enabled,omitempty"`
Color string `json:"color,omitempty"`
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+
LeftClick struct {
Enabled bool `json:"enabled,omitempty"`
Cmd []string `json:"cmd,omitempty"`
@@ -51,19 +130,50 @@ type MyConfig struct {
AlmostFull string `json:"almost_full,omitempty"`
AlmostEmpty string `json:"almost_empty,omitempty"`
} `json:"color,omitempty"`
+
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
} `json:"battery,omitempty"`
CPUTemp struct {
- Enabled bool `json:"enabled,omitempty"`
- File []string `json:"file,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+ File []string `json:"file,omitempty"`
} `json:"cpu_temp,omitempty"`
- CapsLock struct {
- Enabled bool `json:"enabled,omitempty"`
- Background string `json:"background,omitempty"`
- Color string `json:"color,omitempty"`
- } `json:"capslock,omitempty"`
-
Vpn struct {
Enabled bool `json:"enabled,omitempty"`
StatusFile string `json:"statusFile,omitempty"`
@@ -71,6 +181,25 @@ type MyConfig struct {
DownColor string `json:"down_color,omitempty"`
UpColor string `json:"up_color,omitempty"`
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+
TCPCheck struct {
Enabled bool `json:"enabled,omitempty"`
Host string `json:"host,omitempty"`
@@ -80,8 +209,28 @@ type MyConfig struct {
} `json:"vpn,omitempty"`
SimpleVolumePa struct {
- Enabled bool `json:"enabled,omitempty"`
- Symbol string `json:"symbol,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+
Step int `json:"step,omitempty"`
RightClickCmd []string `json:"right_click_cmd,omitempty"`
WheelUp int `json:"wheel_up,omitempty"`
@@ -94,6 +243,25 @@ type MyConfig struct {
DownColor string `json:"down_color,omitempty"`
UpColor string `json:"up_color,omitempty"`
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+
If []struct {
Name string `json:"name,omitempty"`
Dir string `json:"dir,omitempty"`
@@ -110,7 +278,28 @@ type MyConfig struct {
} `json:"tasks,omitempty"`
} `json:"cron,omitempty"`
- AppButtons bool `json:"app_buttons,omitempty"`
+ AppButtons struct {
+ Enabled bool `json:"enabled,omitempty"`
+
+ Separator struct {
+ Left struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"left,omitempty"`
+ Right struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ } `json:"right,omitempty"`
+ } `json:"separator,omitempty"`
+ } `json:"app_buttons,omitempty"`
Apps []struct {
FullText string `json:"full_text,omitempty"`
@@ -217,12 +406,361 @@ func readConf() (MyConfig, error) {
sampleConfig.Background = "#edeceb"
}
- // sampleConfig.La will be false if not set in config
- // sampleConfig.Mem will be false if not set in config
- // sampleConfig.Clock.Enabled will be false if not set in config
+ if sampleConfig.Separator.Left.Enabled {
+ if sampleConfig.Separator.Left.Color == "" {
+ sampleConfig.Separator.Left.Color = "#edeceb"
+ }
- if sampleConfig.Clock.Color == "" {
- sampleConfig.Clock.Color = "#666666"
+ if sampleConfig.Separator.Left.Background == "" {
+ sampleConfig.Separator.Left.Background = "#3e78fd"
+ }
+
+ if sampleConfig.Separator.Left.Symbol == "" {
+ sampleConfig.Separator.Left.Symbol = "|"
+ }
+
+ if sampleConfig.Separator.Left.Font == "" {
+ sampleConfig.Separator.Left.Font = "Noto Sans"
+ }
+
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf("Unable to set sampleConfig.Separator.Left.FontSize: %s, fallback to medium", err)
+
+ sampleConfig.Separator.Left.FontSize = "medium"
+ }
+
+ if !matched {
+ log.Printf("Unable to set sampleConfig.Separator.Left.FontSize: %s, fallback to medium", err)
+
+ sampleConfig.Separator.Left.FontSize = "medium"
+ }
+ }
+
+ if sampleConfig.Separator.Right.Enabled {
+ if sampleConfig.Separator.Right.Color == "" {
+ sampleConfig.Separator.Right.Color = "#edeceb"
+ }
+
+ if sampleConfig.Separator.Right.Background == "" {
+ sampleConfig.Separator.Right.Background = "#3e78fd"
+ }
+
+ if sampleConfig.Separator.Right.Symbol == "" {
+ sampleConfig.Separator.Right.Symbol = "|"
+ }
+
+ if sampleConfig.Separator.Right.Font == "" {
+ sampleConfig.Separator.Right.Font = "Noto Sans"
+ }
+
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf("Unable to set sampleConfig.Separator.Right.FontSize: %s, fallback to medium", err)
+
+ sampleConfig.Separator.Right.FontSize = "medium"
+ }
+
+ if !matched {
+ log.Printf("Unable to set sampleConfig.Separator.Right.FontSize: %s, fallback to medium", err)
+
+ sampleConfig.Separator.Right.FontSize = "medium"
+ }
+ }
+
+ // sampleConfig.LA will be false if not set in config
+ if sampleConfig.LA.Enabled {
+ if sampleConfig.LA.Separator.Left.Enabled {
+ if sampleConfig.LA.Separator.Left.Color == "" {
+ sampleConfig.LA.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.LA.Separator.Left.Background == "" {
+ sampleConfig.LA.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.LA.Separator.Left.Symbol == "" {
+ sampleConfig.LA.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.LA.Separator.Left.Font == "" {
+ sampleConfig.LA.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.LA.Separator.Left.FontSize == "" {
+ sampleConfig.LA.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.LA.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.LA.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.LA.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.LA.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.LA.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.LA.Separator.Right.Enabled {
+ if sampleConfig.LA.Separator.Right.Color == "" {
+ sampleConfig.LA.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.LA.Separator.Right.Background == "" {
+ sampleConfig.LA.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.LA.Separator.Right.Symbol == "" {
+ sampleConfig.LA.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.LA.Separator.Right.Font == "" {
+ sampleConfig.LA.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.LA.Separator.Right.FontSize == "" {
+ sampleConfig.LA.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.LA.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.LA.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.LA.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.LA.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.LA.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
+ }
+
+ // sampleConfig.Mem will be false if not set in config
+ if sampleConfig.Mem.Enabled {
+ if sampleConfig.Mem.Separator.Left.Color == "" {
+ sampleConfig.Mem.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.Mem.Separator.Left.Background == "" {
+ sampleConfig.Mem.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.Mem.Separator.Left.Symbol == "" {
+ sampleConfig.Mem.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.Mem.Separator.Left.Font == "" {
+ sampleConfig.Mem.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.Mem.Separator.Left.FontSize == "" {
+ sampleConfig.Mem.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Mem.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Mem.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Mem.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Mem.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Mem.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+
+ if sampleConfig.Mem.Separator.Right.Enabled {
+ if sampleConfig.Mem.Separator.Right.Color == "" {
+ sampleConfig.Mem.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.Mem.Separator.Right.Background == "" {
+ sampleConfig.Mem.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.Mem.Separator.Right.Symbol == "" {
+ sampleConfig.Mem.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.Mem.Separator.Right.Font == "" {
+ sampleConfig.Mem.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.Mem.Separator.Right.FontSize == "" {
+ sampleConfig.Mem.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Clock.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Mem.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Clock.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Mem.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Mem.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Mem.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
+ }
+
+ // sampleConfig.Clock.Enabled will be false if not set in config
+ if sampleConfig.Clock.Enabled {
+ if sampleConfig.Clock.Color == "" {
+ sampleConfig.Clock.Color = "#666666"
+ }
+
+ if sampleConfig.Clock.Separator.Left.Enabled {
+ if sampleConfig.Clock.Separator.Left.Color == "" {
+ sampleConfig.Clock.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.Clock.Separator.Left.Background == "" {
+ sampleConfig.Clock.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.Clock.Separator.Left.Symbol == "" {
+ sampleConfig.Clock.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.Clock.Separator.Left.Font == "" {
+ sampleConfig.Clock.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.Clock.Separator.Left.FontSize == "" {
+ sampleConfig.Clock.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Clock.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Clock.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Clock.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Clock.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Clock.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.Clock.Separator.Right.Enabled {
+ if sampleConfig.Clock.Separator.Right.Color == "" {
+ sampleConfig.Clock.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.Clock.Separator.Right.Background == "" {
+ sampleConfig.Clock.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.Clock.Separator.Right.Symbol == "" {
+ sampleConfig.Clock.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.Clock.Separator.Right.Font == "" {
+ sampleConfig.Clock.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.Clock.Separator.Right.FontSize == "" {
+ sampleConfig.Clock.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Clock.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Clock.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Clock.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Clock.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Clock.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Clock.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
}
// sampleConfig.Clock.LeftClick.Enabled will be false if not set in config
@@ -237,11 +775,102 @@ func readConf() (MyConfig, error) {
sampleConfig.Clock.RightClick.Cmd = append(sampleConfig.Clock.RightClick.Cmd, "true")
}
- // sampleConfig.battery.Enabled will be false if not set in config
+ // sampleConfig.Battery.Enabled will be false if not set in config
// sampleConfig.Battery.Color.Full will be empty string if not set
// sampleConfig.Battery.Color.Empty will be empty string if not set
// sampleConfig.Battery.Color.AlmostFull will be empty string if not set
// sampleConfig.Battery.Color.AlmostEmpty will be empty string if not set
+ if sampleConfig.Battery.Separator.Left.Enabled {
+ if sampleConfig.Battery.Separator.Left.Color == "" {
+ sampleConfig.Battery.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.Battery.Separator.Left.Background == "" {
+ sampleConfig.Battery.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.Battery.Separator.Left.Symbol == "" {
+ sampleConfig.Battery.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.Battery.Separator.Left.Font == "" {
+ sampleConfig.Battery.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.Battery.Separator.Left.FontSize == "" {
+ sampleConfig.Battery.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Battery.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Battery.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Battery.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Battery.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Battery.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.Battery.Separator.Right.Enabled {
+ if sampleConfig.Battery.Separator.Right.Color == "" {
+ sampleConfig.Battery.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.Battery.Separator.Right.Background == "" {
+ sampleConfig.Battery.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.Battery.Separator.Right.Symbol == "" {
+ sampleConfig.Battery.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.Battery.Separator.Right.Font == "" {
+ sampleConfig.Battery.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.Battery.Separator.Right.FontSize == "" {
+ sampleConfig.Battery.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Battery.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Battery.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Battery.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Battery.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Battery.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
// sampleConfig.CpuTemp.Enabled will be false if not set in config
@@ -250,14 +879,96 @@ func readConf() (MyConfig, error) {
sampleConfig.CPUTemp.Enabled = false
}
- // sampleConfig.CapsLock.Enabled will false if not set in config
+ if sampleConfig.CPUTemp.Enabled {
+ if sampleConfig.CPUTemp.Separator.Left.Enabled {
+ if sampleConfig.CPUTemp.Separator.Left.Color == "" {
+ sampleConfig.CPUTemp.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
- if sampleConfig.CapsLock.Color == "" {
- sampleConfig.CapsLock.Color = "#3e78fd"
- }
+ if sampleConfig.CPUTemp.Separator.Left.Background == "" {
+ sampleConfig.CPUTemp.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
- if sampleConfig.CapsLock.Background == "" {
- sampleConfig.CapsLock.Background = "#edeceb"
+ if sampleConfig.CPUTemp.Separator.Left.Symbol == "" {
+ sampleConfig.CPUTemp.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.CPUTemp.Separator.Left.Font == "" {
+ sampleConfig.CPUTemp.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.CPUTemp.Separator.Left.FontSize == "" {
+ sampleConfig.CPUTemp.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.CPUTemp.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.CPUTemp.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.CPUTemp.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.CPUTemp.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.CPUTemp.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.CPUTemp.Separator.Right.Enabled {
+ if sampleConfig.CPUTemp.Separator.Right.Color == "" {
+ sampleConfig.CPUTemp.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.CPUTemp.Separator.Right.Background == "" {
+ sampleConfig.CPUTemp.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.CPUTemp.Separator.Right.Symbol == "" {
+ sampleConfig.CPUTemp.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.CPUTemp.Separator.Right.Font == "" {
+ sampleConfig.CPUTemp.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.CPUTemp.Separator.Right.FontSize == "" {
+ sampleConfig.CPUTemp.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.CPUTemp.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf("Unable to set sampleConfig.CPUTemp.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.CPUTemp.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf("Unable to set sampleConfig.CPUTemp.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.CPUTemp.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
}
// sampleConfig.Vpn.Enabled will false if not set in config
@@ -267,104 +978,477 @@ func readConf() (MyConfig, error) {
sampleConfig.Vpn.Enabled = false
}
- // Check status file at least once per 3 seconds
- if sampleConfig.Vpn.MtimeThreshold < 3 {
- if sampleConfig.Vpn.Enabled {
+ if sampleConfig.Vpn.Enabled {
+ // Check status file at least once per 3 seconds
+ if sampleConfig.Vpn.MtimeThreshold < 3 {
log.Printf("vpn.mtime_threshold not set, using 3")
+
+ sampleConfig.Vpn.MtimeThreshold = 3 //nocritic: wsl
}
- sampleConfig.Vpn.MtimeThreshold = 3 //nocritic: wsl
- }
+ // sampleConfig.Vpn.DownColor will be empty string if no value set in config
+ // sampleConfig.Vpn.UpColor will be empty string if no value set in config
+ // sampleConfig.Vpn.TcpCheck.Enabled will false if not set in config
- // sampleConfig.Vpn.DownColor will be empty string if no value set in config
- // sampleConfig.Vpn.UpColor will be empty string if no value set in config
- // sampleConfig.Vpn.TcpCheck.Enabled will false if not set in config
+ if sampleConfig.Vpn.Separator.Left.Enabled {
+ if sampleConfig.Vpn.Separator.Left.Color == "" {
+ sampleConfig.Vpn.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
- // Disable plugin if value inadequate
- if sampleConfig.Vpn.TCPCheck.Port > 65535 {
- if sampleConfig.Vpn.TCPCheck.Enabled {
- log.Printf("vpn.tcp_check.port > 65535, disabling vpn.tcp_check.enabled")
+ if sampleConfig.Vpn.Separator.Left.Background == "" {
+ sampleConfig.Vpn.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.Vpn.Separator.Left.Symbol == "" {
+ sampleConfig.Vpn.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.Vpn.Separator.Left.Font == "" {
+ sampleConfig.Vpn.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.Vpn.Separator.Left.FontSize == "" {
+ sampleConfig.Vpn.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Vpn.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Vpn.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Vpn.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Vpn.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.Vpn.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
}
- sampleConfig.Vpn.TCPCheck.Enabled = false
- }
+ if sampleConfig.Vpn.Separator.Right.Enabled {
+ if sampleConfig.Vpn.Separator.Right.Color == "" {
+ sampleConfig.Vpn.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
- // Disable plugin if value indaquate
- if sampleConfig.Vpn.TCPCheck.Host == "" {
- if sampleConfig.Vpn.TCPCheck.Enabled {
- log.Printf("vpn.tcp_check.host not set, disabling vpn.tcp_check.enabled")
+ if sampleConfig.Vpn.Separator.Right.Background == "" {
+ sampleConfig.Vpn.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.Vpn.Separator.Right.Symbol == "" {
+ sampleConfig.Vpn.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.Vpn.Separator.Right.Font == "" {
+ sampleConfig.Vpn.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.Vpn.Separator.Right.FontSize == "" {
+ sampleConfig.Vpn.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.Vpn.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.Vpn.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Vpn.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.Vpn.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.Vpn.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
}
- sampleConfig.Vpn.TCPCheck.Enabled = false
- }
+ // Disable plugin if value inadequate
+ if sampleConfig.Vpn.TCPCheck.Port > 65535 {
+ if sampleConfig.Vpn.TCPCheck.Enabled {
+ log.Printf("vpn.tcp_check.port > 65535, disabling vpn.tcp_check.enabled")
+ }
- if sampleConfig.Vpn.TCPCheck.Timeout < 3 {
- if sampleConfig.Vpn.TCPCheck.Enabled {
- log.Printf("vpn.tcp_check.timeout < 3, using 3")
+ sampleConfig.Vpn.TCPCheck.Enabled = false
}
- sampleConfig.Vpn.TCPCheck.Timeout = 3
+ // Disable plugin if value indaquate
+ if sampleConfig.Vpn.TCPCheck.Host == "" {
+ if sampleConfig.Vpn.TCPCheck.Enabled {
+ log.Printf("vpn.tcp_check.host not set, disabling vpn.tcp_check.enabled")
+ }
+
+ sampleConfig.Vpn.TCPCheck.Enabled = false
+ }
+
+ if sampleConfig.Vpn.TCPCheck.Timeout < 3 {
+ if sampleConfig.Vpn.TCPCheck.Enabled {
+ log.Printf("vpn.tcp_check.timeout < 3, using 3")
+ }
+
+ sampleConfig.Vpn.TCPCheck.Timeout = 3
+ }
}
// TODO: appbuttons, etc..
// sampleConfig.SimpleVolumePa.Enabled will false if not set in config
- if sampleConfig.SimpleVolumePa.Symbol == "" {
- sampleConfig.SimpleVolumePa.Symbol = `🔊`
- }
-
- if sampleConfig.SimpleVolumePa.Step == 0 {
- sampleConfig.SimpleVolumePa.Step = 5
- }
-
- if sampleConfig.SimpleVolumePa.WheelUp == 0 {
- sampleConfig.SimpleVolumePa.WheelUp = 4
- }
-
- if sampleConfig.SimpleVolumePa.WheelDown == 0 {
- sampleConfig.SimpleVolumePa.WheelDown = 5
- }
-
- if sampleConfig.SimpleVolumePa.MaxVolumeLimit == 0 {
- sampleConfig.SimpleVolumePa.MaxVolumeLimit = 100
- }
-
- if len(sampleConfig.SimpleVolumePa.RightClickCmd) > 0 {
- if sampleConfig.SimpleVolumePa.RightClickCmd[0] == "" {
- sampleConfig.SimpleVolumePa.RightClickCmd[0] = "true"
+ if sampleConfig.SimpleVolumePa.Enabled {
+ if sampleConfig.SimpleVolumePa.Symbol == "" {
+ sampleConfig.SimpleVolumePa.Symbol = `🔊`
+ }
+
+ if sampleConfig.SimpleVolumePa.Step == 0 {
+ sampleConfig.SimpleVolumePa.Step = 5
+ }
+
+ if sampleConfig.SimpleVolumePa.WheelUp == 0 {
+ sampleConfig.SimpleVolumePa.WheelUp = 4
+ }
+
+ if sampleConfig.SimpleVolumePa.WheelDown == 0 {
+ sampleConfig.SimpleVolumePa.WheelDown = 5
+ }
+
+ if sampleConfig.SimpleVolumePa.MaxVolumeLimit == 0 {
+ sampleConfig.SimpleVolumePa.MaxVolumeLimit = 100
+ }
+
+ if len(sampleConfig.SimpleVolumePa.RightClickCmd) > 0 {
+ if sampleConfig.SimpleVolumePa.RightClickCmd[0] == "" {
+ sampleConfig.SimpleVolumePa.RightClickCmd[0] = "true"
+ }
+ } else {
+ sampleConfig.SimpleVolumePa.RightClickCmd = append(sampleConfig.SimpleVolumePa.RightClickCmd, "true")
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Left.Enabled {
+ if sampleConfig.SimpleVolumePa.Separator.Left.Color == "" {
+ sampleConfig.SimpleVolumePa.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Left.Background == "" {
+ sampleConfig.SimpleVolumePa.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Left.Symbol == "" {
+ sampleConfig.SimpleVolumePa.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Left.Font == "" {
+ sampleConfig.SimpleVolumePa.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Left.FontSize == "" {
+ sampleConfig.SimpleVolumePa.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.SimpleVolumePa.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.SimpleVolumePa.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.SimpleVolumePa.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.SimpleVolumePa.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.SimpleVolumePa.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Right.Enabled {
+ if sampleConfig.SimpleVolumePa.Separator.Right.Color == "" {
+ sampleConfig.SimpleVolumePa.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Right.Background == "" {
+ sampleConfig.SimpleVolumePa.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Right.Symbol == "" {
+ sampleConfig.SimpleVolumePa.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Right.Font == "" {
+ sampleConfig.SimpleVolumePa.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.SimpleVolumePa.Separator.Right.FontSize == "" {
+ sampleConfig.SimpleVolumePa.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.SimpleVolumePa.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.SimpleVolumePa.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.SimpleVolumePa.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.SimpleVolumePa.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.SimpleVolumePa.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
}
- } else {
- sampleConfig.SimpleVolumePa.RightClickCmd = append(sampleConfig.SimpleVolumePa.RightClickCmd, "true")
}
// sampleConfig.Cron.Enabled will false if not set in config
- if sampleConfig.Cron.TimeZone == "" {
- sampleConfig.Cron.TimeZone = "GMT+0"
- }
-
if len(sampleConfig.Cron.Tasks) == 0 {
sampleConfig.Cron.Enabled = false
}
+ if sampleConfig.Cron.Enabled {
+ if sampleConfig.Cron.TimeZone == "" {
+ sampleConfig.Cron.TimeZone = "GMT+0"
+ }
+ }
// sampleConfig.NetIf.Enabled will false if not set in config
if len(sampleConfig.NetIf.If) == 0 {
sampleConfig.NetIf.Enabled = false
}
- if sampleConfig.NetIf.DownColor == "" {
- sampleConfig.NetIf.DownColor = "red"
+ if sampleConfig.NetIf.Enabled {
+ if sampleConfig.NetIf.DownColor == "" {
+ sampleConfig.NetIf.DownColor = "red"
+ }
+
+ if sampleConfig.NetIf.UpColor == "" {
+ sampleConfig.NetIf.UpColor = "green"
+ }
+
+ if sampleConfig.NetIf.Separator.Left.Enabled {
+ if sampleConfig.NetIf.Separator.Left.Color == "" {
+ sampleConfig.NetIf.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.NetIf.Separator.Left.Background == "" {
+ sampleConfig.NetIf.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.NetIf.Separator.Left.Symbol == "" {
+ sampleConfig.NetIf.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.NetIf.Separator.Left.Font == "" {
+ sampleConfig.NetIf.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.NetIf.Separator.Left.FontSize == "" {
+ sampleConfig.NetIf.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.NetIf.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.NetIf.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.NetIf.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf("Unable to set sampleConfig.NetIf.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.Separator.Left.FontSize,
+ )
+
+ sampleConfig.NetIf.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.NetIf.Separator.Right.Enabled {
+ if sampleConfig.NetIf.Separator.Right.Color == "" {
+ sampleConfig.NetIf.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.NetIf.Separator.Right.Background == "" {
+ sampleConfig.NetIf.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.NetIf.Separator.Right.Symbol == "" {
+ sampleConfig.NetIf.Separator.Right.Symbol = sampleConfig.Separator.Right.Symbol
+ }
+
+ if sampleConfig.NetIf.Separator.Right.Font == "" {
+ sampleConfig.NetIf.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.NetIf.Separator.Right.FontSize == "" {
+ sampleConfig.NetIf.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.NetIf.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.NetIf.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.NetIf.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.NetIf.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.NetIf.Separator.Right.FontSize,
+ )
+
+ sampleConfig.NetIf.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
}
- if sampleConfig.NetIf.UpColor == "" {
- sampleConfig.NetIf.UpColor = "green"
- }
+ // sampleConfig.AppButtons.Enabled will false if not set in config
- // sampleConfig.AppButtons will false if not set in config
+ if sampleConfig.AppButtons.Enabled {
+ if sampleConfig.AppButtons.Separator.Left.Enabled {
+ if sampleConfig.AppButtons.Separator.Left.Color == "" {
+ sampleConfig.AppButtons.Separator.Left.Color = sampleConfig.Separator.Left.Color
+ }
+
+ if sampleConfig.AppButtons.Separator.Left.Background == "" {
+ sampleConfig.AppButtons.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ }
+
+ if sampleConfig.AppButtons.Separator.Left.Symbol == "" {
+ sampleConfig.AppButtons.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ }
+
+ if sampleConfig.AppButtons.Separator.Left.Font == "" {
+ sampleConfig.AppButtons.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ }
+
+ if sampleConfig.AppButtons.Separator.Left.FontSize == "" {
+ sampleConfig.AppButtons.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.AppButtons.Separator.Left.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.AppButtons.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.AppButtons.Separator.Left.FontSize,
+ )
+
+ sampleConfig.AppButtons.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+
+ if !matched {
+ log.Printf(
+ "Unable to set sampleConfig.AppButtons.Separator.Left.FontSize, fallback to %s",
+ sampleConfig.AppButtons.Separator.Left.FontSize,
+ )
+
+ sampleConfig.AppButtons.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ }
+ }
+ }
+
+ if sampleConfig.AppButtons.Separator.Right.Enabled {
+ if sampleConfig.AppButtons.Separator.Right.Color == "" {
+ sampleConfig.AppButtons.Separator.Right.Color = sampleConfig.Separator.Right.Color
+ }
+
+ if sampleConfig.AppButtons.Separator.Right.Background == "" {
+ sampleConfig.AppButtons.Separator.Right.Background = sampleConfig.Separator.Right.Background
+ }
+
+ if sampleConfig.AppButtons.Separator.Right.Symbol == "" {
+ sampleConfig.AppButtons.Separator.Right.Symbol = "|"
+ }
+
+ if sampleConfig.AppButtons.Separator.Right.Font == "" {
+ sampleConfig.AppButtons.Separator.Right.Font = sampleConfig.Separator.Right.Font
+ }
+
+ if sampleConfig.AppButtons.Separator.Right.FontSize == "" {
+ sampleConfig.AppButtons.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ } else {
+ matched, err := regexp.MatchString(
+ `^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
+ sampleConfig.AppButtons.Separator.Right.FontSize,
+ )
+
+ if err != nil {
+ log.Printf(
+ "Unable to set sampleConfig.AppButtons.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.AppButtons.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+
+ if !matched {
+ log.Printf("Unable to set sampleConfig.AppButtons.Separator.Right.FontSize, fallback to %s",
+ sampleConfig.Separator.Right.FontSize,
+ )
+
+ sampleConfig.AppButtons.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
+ }
+ }
+ }
+ }
if len(sampleConfig.Apps) == 0 {
- sampleConfig.AppButtons = false
+ sampleConfig.AppButtons.Enabled = false
} else {
for num, app := range sampleConfig.Apps {
// app.Instance can be missing.
diff --git a/i3status-go-example.json b/i3status-go-example.json
index 70da3e3..7dcd861 100644
--- a/i3status-go-example.json
+++ b/i3status-go-example.json
@@ -5,13 +5,214 @@
// Default backbround color. If not set value of #edeceb is used.
"background" : "#000000",
-// Load Average
-"la" : true,
+"separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ // False if value omitted
+ "enabled": true,
+ // Used #edeceb as default if value omitted
+ "color": "#3e78fd",
+ // If not set #3e78fd is used.
+ "background": "#000000",
+ // If omitted, used "|" (no quotes) as default
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+},
// Memory stats
"mem" : {
"enabled": true,
- "show_swap": false
+ "show_swap": false,
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ }
+},
+
+// Load Average
+"la" : {
+ "enabled": true,
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ }
+},
+
+"net-if" : {
+ "enabled" : false,
+ // In html notation
+ "down_color" : "red",
+ "up_color" : "green",
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ },
+
+ "if" : [
+ {
+ // Name as it displayed on i3bar
+ "name" : "eth0",
+ // Directory containing net if status files
+ "dir" : "/sys/class/net/eth0"
+ }
+ ]
+},
+
+// OpenVPN status. Note that directive status in openvpn.conf should point to
+// state file and *update* its timestamp at least as frequent as mtime_threshold in seconds
+"vpn": {
+ "enabled": false,
+ "statusfile" : "/tmp/openvpn-status.stat",
+ "mtime_threshold": 10,
+ // Color in html notation
+ "down_color" : "red",
+ "up_color" : "green",
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ },
+
+ // Also we can tcp-ping some service inside vpn network to ensure that connection is not stoned
+ "tcp_check" : {
+ "enabled": false,
+ "host": "somehost.tld",
+ "port": 443,
+ "timeout" : 3
+ }
+},
+
+// Simple sound volume indicator
+"simple-volume-pa": {
+ "enabled": false,
+ "symbol": "🔊",
+ // If not defined - will be "true"
+ "right_click_cmd": ["pavucontrol"],
+ // Change volume step in %, if not configured it is 5
+ "step": 3,
+ // We'll change volume level with mouse wheel. Under X11 it is mapped to some buttons, typically 4 and 5 (z-axis).
+ // If omited, default value is 4
+ "wheel_up": 4,
+ // If omited, default value is 5
+ "wheel_down": 5,
+ // Maximum sound volume, can be over 100%, but sould not be :) Default value 100 if not set.
+ "max_volume_limit": 120,
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ }
},
// Just clock
@@ -20,6 +221,30 @@
// Text color in html (actually, pango) notation
"color" : "#666666",
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ },
+
"left_click" : {
"enabled" : false,
// cmd is array of command itself and its arguments
@@ -42,6 +267,30 @@
"empty": "red",
"almost_full": "yellow",
"almost_empty": "orange"
+ },
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
}
},
@@ -49,6 +298,30 @@
"cpu_temp": {
"enabled": false,
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "background": "#000000",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ },
+
// Files in sysfs that contains cpu temperatures
"file": [
"/sys/class/hwmon/hwmon4/temp2_input",
@@ -60,58 +333,6 @@
]
},
-// OpenVPN status. Note that directive status in openvpn.conf should point to
-// state file and *update* its timestamp at least as frequent as mtime_threshold in seconds
-"vpn": {
- "enabled": false,
- "statusfile" : "/tmp/openvpn-status.stat",
- "mtime_threshold": 10,
- // Color in html notation
- "down_color" : "red",
- "up_color" : "green",
- // Also we can tcp-ping some service inside vpn network to ensure that connection is not stoned
-
- "tcp_check" : {
- "enabled": false,
- "host": "somehost.tld",
- "port": 443,
- "timeout" : 3
- }
-},
-
-// Simple sound volume indicator
-"simple-volume-pa": {
- "enabled": false,
- "symbol": "🔊",
- // If not defined - will be "true"
- "right_click_cmd": ["pavucontrol"],
- // Change volume step in %, if not configured it is 5
- "step": 3,
- // We'll change volume level with mouse wheel. Under X11 it is mapped to some buttons, typically 4 and 5 (z-axis).
- // If omited, default value is 4
- "wheel_up": 4,
- // If omited, default value is 5
- "wheel_down": 5,
- // Maximum sound volume, can be over 100%, but sould not be :) Default value 100 if not set.
- "max_volume_limit": 120
-},
-
-"net-if" : {
- "enabled" : false,
- // In html notation
- "down_color" : "red",
- "up_color" : "green",
-
- "if" : [
- {
- // Name as it displayed on i3bar
- "name" : "eth0",
- // Directory containing net if status files
- "dir" : "/sys/class/net/eth0"
- }
- ]
-},
-
// Intended mainly for use with desktop notifications
// Because it inherits all env vars from i3, it can intercat with dbus and other
// such user session services.
@@ -138,7 +359,31 @@
},
// Weather to display Application Buttons
-"app_buttons": true,
+"app_buttons": {
+ "enabled": true,
+
+ "separator" : {
+ "left": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "symbol": "▶",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ },
+
+ "right": {
+ "enabled": true,
+ "color": "#3e78fd",
+ "symbol": "◀",
+ "font": "Noto Sans",
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or a percentage (e.g. ‘200%’), or
+ // one of the relative sizes ‘smaller’ or ‘larger’
+ "font_size": "medium"
+ }
+ }
+},
// Buttons - application launch "buttons"
"apps": [
diff --git a/main.go b/main.go
index e13ae84..fd49a7b 100644
--- a/main.go
+++ b/main.go
@@ -59,7 +59,7 @@ func main() {
go ParseStdin()
go CleanZombies()
- if Conf.AppButtons {
+ if Conf.AppButtons.Enabled {
go UpdateI3WinList()
}
@@ -75,7 +75,7 @@ func main() {
}
// Populate LA stats
- if Conf.LA {
+ if Conf.LA.Enabled {
go UpdateLaStats()
}
@@ -131,11 +131,33 @@ func main() {
// Actually build json struct, marshal it and print result
var j []I3BarOutBlock
- if Conf.AppButtons {
- for _, app := range Conf.Apps {
+ // TODO: впилить для первого и последнего батона separator
+ if Conf.AppButtons.Enabled {
+ for num, app := range Conf.Apps {
var b I3BarOutBlock
+ if num == 0 {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.AppButtons.Separator.Left.Color,
+ Conf.AppButtons.Separator.Left.Background,
+ Conf.AppButtons.Separator.Left.FontSize,
+ Conf.AppButtons.Separator.Left.Symbol,
+ )
+ }
+
b.FullText = app.FullText
+
+ if num == len(Conf.Apps) {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.AppButtons.Separator.Right.Color,
+ Conf.AppButtons.Separator.Right.Background,
+ Conf.AppButtons.Separator.Right.FontSize,
+ Conf.AppButtons.Separator.Right.Symbol,
+ )
+ }
+
b.Background = app.Background
b.Color = app.Color
b.Instance = app.Instance
@@ -156,71 +178,256 @@ func main() {
if Conf.CPUTemp.Enabled {
var b I3BarOutBlock
- b.FullText = fmt.Sprintf("CPU: %d°", CPUTemperature)
- b.Separator = true
+
+ if Conf.CPUTemp.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.CPUTemp.Separator.Left.Color,
+ Conf.CPUTemp.Separator.Left.Background,
+ Conf.CPUTemp.Separator.Left.FontSize,
+ Conf.CPUTemp.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += fmt.Sprintf("CPU: %d°", CPUTemperature)
+
+ if Conf.CPUTemp.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.CPUTemp.Separator.Right.Color,
+ Conf.CPUTemp.Separator.Right.Background,
+ Conf.CPUTemp.Separator.Right.FontSize,
+ Conf.CPUTemp.Separator.Right.Symbol,
+ )
+ }
+
+ b.Markup = "pango"
+ b.Separator = false
+
j = append(j, b)
}
if Conf.Mem.Enabled {
var b I3BarOutBlock
- if Conf.Mem.ShowSwap {
- b.FullText = fmt.Sprintf("M:%d%% SHM:%dM SW:%dM", Memory.Usedpct, Memory.Shared, Memory.Swap)
- } else {
- b.FullText = fmt.Sprintf("M:%d%% SHM:%dM", Memory.Usedpct, Memory.Shared)
+ if Conf.Mem.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.Mem.Separator.Left.Color,
+ Conf.Mem.Separator.Left.Background,
+ Conf.Mem.Separator.Left.FontSize,
+ Conf.Mem.Separator.Left.Symbol,
+ )
}
- b.Separator = true
+ if Conf.Mem.ShowSwap {
+ b.FullText += fmt.Sprintf("M:%d%% SHM:%dM SW:%dM", Memory.Usedpct, Memory.Shared, Memory.Swap)
+ } else {
+ b.FullText += fmt.Sprintf("M:%d%% SHM:%dM", Memory.Usedpct, Memory.Shared)
+ }
+
+ if Conf.Mem.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.Mem.Separator.Right.Color,
+ Conf.Mem.Separator.Right.Background,
+ Conf.Mem.Separator.Right.FontSize,
+ Conf.Mem.Separator.Right.Symbol,
+ )
+ }
+
+ b.Markup = "pango"
+ b.Separator = false
j = append(j, b)
}
- if Conf.LA {
+ if Conf.LA.Enabled {
var b I3BarOutBlock
- b.FullText = fmt.Sprintf("La: %s", La)
- b.Separator = true
+
+ if Conf.LA.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.LA.Separator.Left.Color,
+ Conf.LA.Separator.Left.Background,
+ Conf.LA.Separator.Left.FontSize,
+ Conf.LA.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += fmt.Sprintf("LA: %s", La)
+
+ if Conf.LA.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.LA.Separator.Right.Color,
+ Conf.LA.Separator.Right.Background,
+ Conf.LA.Separator.Right.FontSize,
+ Conf.LA.Separator.Right.Symbol,
+ )
+ }
+
+ b.Markup = "pango"
+ b.Separator = false
+
j = append(j, b)
}
if Conf.NetIf.Enabled {
var b I3BarOutBlock
- b.FullText = IfStatus
+
+ if Conf.NetIf.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.NetIf.Separator.Left.Color,
+ Conf.NetIf.Separator.Left.Background,
+ Conf.NetIf.Separator.Left.FontSize,
+ Conf.NetIf.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += IfStatus
+
+ if Conf.NetIf.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.NetIf.Separator.Right.Color,
+ Conf.NetIf.Separator.Right.Background,
+ Conf.NetIf.Separator.Right.FontSize,
+ Conf.NetIf.Separator.Right.Symbol,
+ )
+ }
+
b.Markup = "pango"
- b.Separator = true
+ b.Separator = false
+
j = append(j, b)
}
if Conf.Vpn.Enabled {
var b I3BarOutBlock
- b.FullText = VPNStatus
+
+ if Conf.Vpn.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.Vpn.Separator.Left.Color,
+ Conf.Vpn.Separator.Left.Background,
+ Conf.Vpn.Separator.Left.FontSize,
+ Conf.Vpn.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += VPNStatus
+
+ if Conf.Vpn.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.Vpn.Separator.Right.Color,
+ Conf.Vpn.Separator.Right.Background,
+ Conf.Vpn.Separator.Right.FontSize,
+ Conf.Vpn.Separator.Right.Symbol,
+ )
+ }
+
b.Markup = "pango"
- b.Separator = true
+ b.Separator = false
+
j = append(j, b)
}
if Conf.Battery.Enabled {
var b I3BarOutBlock
- b.FullText = Batt
- b.Separator = true
+
+ if Conf.Battery.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.Battery.Separator.Left.Color,
+ Conf.Battery.Separator.Left.Background,
+ Conf.Battery.Separator.Left.FontSize,
+ Conf.Battery.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += Batt
+
+ if Conf.Battery.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.Battery.Separator.Right.Color,
+ Conf.Battery.Separator.Right.Background,
+ Conf.Battery.Separator.Right.FontSize,
+ Conf.Battery.Separator.Right.Symbol,
+ )
+ }
+
+ b.Markup = "pango"
+ b.Separator = false
+
j = append(j, b)
}
if Conf.SimpleVolumePa.Enabled {
var b I3BarOutBlock
b.Name = "simple-volume-pa"
- b.FullText = SoundVolume
+
+ if Conf.SimpleVolumePa.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.SimpleVolumePa.Separator.Left.Color,
+ Conf.SimpleVolumePa.Separator.Left.Background,
+ Conf.SimpleVolumePa.Separator.Left.FontSize,
+ Conf.SimpleVolumePa.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += SoundVolume
+
+ if Conf.SimpleVolumePa.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.SimpleVolumePa.Separator.Right.Color,
+ Conf.SimpleVolumePa.Separator.Right.Background,
+ Conf.SimpleVolumePa.Separator.Right.FontSize,
+ Conf.SimpleVolumePa.Separator.Right.Symbol,
+ )
+ }
+
b.Markup = "pango"
- b.Separator = true
+ b.Separator = false
+
j = append(j, b)
}
if Conf.Clock.Enabled {
var b I3BarOutBlock
b.Name = `wallclock`
- b.FullText = Clock
+
+ if Conf.Clock.Separator.Left.Enabled {
+ b.FullText = fmt.Sprintf(
+ "%s",
+ Conf.Clock.Separator.Left.Color,
+ Conf.Clock.Separator.Left.Background,
+ Conf.Clock.Separator.Left.FontSize,
+ Conf.Clock.Separator.Left.Symbol,
+ )
+ }
+
+ b.FullText += Clock
+
+ if Conf.Clock.Separator.Right.Enabled {
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.Clock.Separator.Right.Color,
+ Conf.Clock.Separator.Right.Background,
+ Conf.Clock.Separator.Right.FontSize,
+ Conf.Clock.Separator.Right.Symbol,
+ )
+ }
+
b.Markup = "pango"
b.Color = Conf.Clock.Color
- b.Separator = true
+ b.Separator = false
+
j = append(j, b)
}
diff --git a/stdin.go b/stdin.go
index a2bd75a..fc98e80 100644
--- a/stdin.go
+++ b/stdin.go
@@ -143,7 +143,7 @@ func ParseStdin() {
continue
}
- if !Conf.AppButtons {
+ if !Conf.AppButtons.Enabled {
continue
}