diff --git a/batteries.go b/batteries.go
index 4c31067..7510bb4 100644
--- a/batteries.go
+++ b/batteries.go
@@ -23,7 +23,14 @@ func UpdateBatteryInfo() {
batteries, err := battery.GetAll()
if err != nil {
- Batts = "⚡ no batt"
+ Batts = fmt.Sprintf(
+ "%s no batt",
+ Conf.Battery.SymbolFont,
+ Conf.Battery.SymbolFontSize,
+ Conf.Battery.Symbol,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ )
} else {
var (
battsInfo string
@@ -42,57 +49,97 @@ func UpdateBatteryInfo() {
status = `•`
}
- // N.B. there can be case when battery is overcharged and shows >100%. It alse can indicate that
+ // N.B. there can be case when battery is overcharged and shows >100%. It also can indicate that
// calibration data is out of date and battery should be re-calibrated.
ch = int(math.Round((b.Full - b.Current) * (100 / b.Full)))
switch {
case ch > 85:
- if Conf.Battery.Color.Full == "" {
- chStr = fmt.Sprintf("% 3d%%", ch)
+ if Conf.Battery.ChargeColor.Full == "" {
+ chStr = fmt.Sprintf(
+ "% 3d%%",
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.Full,
+ ch,
+ )
} else {
chStr = fmt.Sprintf(
- `% 3d%%`,
- Conf.Battery.Color.Full,
+ `% 3d%%`,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.Full,
ch,
)
}
case ch < 85 && ch > 40:
- if Conf.Battery.Color.AlmostFull == "" {
- chStr = fmt.Sprintf("% 3d%%", ch)
+ if Conf.Battery.ChargeColor.AlmostFull == "" {
+ chStr = fmt.Sprintf(
+ "% 3d%%",
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.Full,
+ ch,
+ )
} else {
chStr = fmt.Sprintf(
- `% 3d%%`,
- Conf.Battery.Color.AlmostFull,
+ `% 3d%%`,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.AlmostFull,
ch,
)
}
case ch <= 40 && ch >= 10:
- if Conf.Battery.Color.AlmostEmpty == "" {
- chStr = fmt.Sprintf("% 3d%%", ch)
+ if Conf.Battery.ChargeColor.AlmostEmpty == "" {
+ chStr = fmt.Sprintf(
+ "% 3d%%",
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.Full,
+ ch,
+ )
} else {
chStr = fmt.Sprintf(
- `% 3d%%`,
- Conf.Battery.Color.AlmostEmpty,
+ `% 3d%%`,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.AlmostEmpty,
ch,
)
}
case ch < 10:
- if Conf.Battery.Color.Empty == "" {
- chStr = fmt.Sprintf("% 3d%%", ch)
+ if Conf.Battery.ChargeColor.Empty == "" {
+ chStr = fmt.Sprintf(
+ "% 3d%%",
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.Full,
+ ch,
+ )
} else {
chStr = fmt.Sprintf(
- `% 3d%%`,
- Conf.Battery.Color.Empty,
+ `% 3d%%`,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ Conf.Battery.ChargeColor.Empty,
ch,
)
}
}
- battsInfo += fmt.Sprintf("⚡B%d %s %s", i, chStr, status)
+ battsInfo += fmt.Sprintf(
+ "%sB%d %s %s",
+ Conf.Battery.SymbolFont,
+ Conf.Battery.SymbolFontSize,
+ Conf.Battery.Symbol,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ i,
+ chStr,
+ Conf.Battery.Font,
+ Conf.Battery.FontSize,
+ status,
+ )
}
if battsInfo != "" {
diff --git a/clock.go b/clock.go
index 0b32ccd..62d9e0c 100644
--- a/clock.go
+++ b/clock.go
@@ -18,7 +18,7 @@ func UpdateClock() {
rmonth := [12]string{"Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"}
rdow := [7]string{"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"}
- myclock := fmt.Sprintf(" %s, %d %s %d % 2d:%02d ", rdow[dow], day, rmonth[month-1], year, hours, minutes)
+ myclock := fmt.Sprintf(" %s, %d %s %d % 2d:%02d ", rdow[dow], day, rmonth[month-1], year, hours, minutes)
if myclock != Clock {
Clock = myclock
diff --git a/config.go b/config.go
index d4e8285..bec7ae5 100644
--- a/config.go
+++ b/config.go
@@ -21,6 +21,12 @@ type MyConfig struct {
// Default background color
Background string `json:"background,omitempty"`
+ // Default text font
+ Font string `json:"font,omitempty"`
+
+ // Default text font size
+ FontSize string `json:"font_size,omitempty"`
+
Separator struct {
Left struct {
Enabled bool `json:"enabled,omitempty"`
@@ -30,6 +36,7 @@ type MyConfig struct {
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"`
@@ -42,7 +49,11 @@ type MyConfig struct {
// LA Plugin
LA struct {
- Enabled bool `json:"enabled,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
Separator struct {
Left struct {
@@ -53,6 +64,7 @@ type MyConfig struct {
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"`
@@ -64,9 +76,14 @@ type MyConfig struct {
} `json:"separator,omitempty"`
} `json:"la,omitempty"`
+ // Mem plugin
Mem struct {
- Enabled bool `json:"enabled,omitempty"`
- ShowSwap bool `json:"show_swap,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ ShowSwap bool `json:"show_swap,omitempty"`
Separator struct {
Left struct {
@@ -89,8 +106,11 @@ type MyConfig struct {
} `json:"mem,omitempty"`
Clock struct {
- Enabled bool `json:"enabled,omitempty"`
- Color string `json:"color,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
Separator struct {
Left struct {
@@ -123,13 +143,21 @@ type MyConfig struct {
} `json:"clock,omitempty"`
Battery struct {
- Enabled bool `json:"enabled,omitempty"`
- Color struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ SymbolFont string `json:"symbol_font,omitempty"`
+ SymbolFontSize string `json:"symbol_font_size,omitempty"`
+
+ ChargeColor struct {
Full string `json:"full,omitempty"`
Empty string `json:"empty,omitempty"`
AlmostFull string `json:"almost_full,omitempty"`
AlmostEmpty string `json:"almost_empty,omitempty"`
- } `json:"color,omitempty"`
+ } `json:"charge_color,omitempty"`
Separator struct {
Left struct {
@@ -152,7 +180,12 @@ type MyConfig struct {
} `json:"battery,omitempty"`
CPUTemp struct {
- Enabled bool `json:"enabled,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+
Separator struct {
Left struct {
Enabled bool `json:"enabled,omitempty"`
@@ -162,6 +195,7 @@ type MyConfig struct {
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"`
@@ -171,11 +205,16 @@ type MyConfig struct {
FontSize string `json:"font_size,omitempty"`
} `json:"right,omitempty"`
} `json:"separator,omitempty"`
+
File []string `json:"file,omitempty"`
} `json:"cpu_temp,omitempty"`
Vpn struct {
Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
StatusFile string `json:"statusFile,omitempty"`
MtimeThreshold int `json:"mtime_threshold,omitempty"`
DownColor string `json:"down_color,omitempty"`
@@ -209,9 +248,15 @@ type MyConfig struct {
} `json:"vpn,omitempty"`
SimpleVolumePa struct {
- Enabled bool `json:"enabled,omitempty"`
- Symbol string `json:"symbol,omitempty"`
- FontSize string `json:"font_size,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
+ Symbol string `json:"symbol,omitempty"`
+ SymbolFont string `json:"symbol_font,omitempty"`
+ SymbolFontSize string `json:"symbol_font_size,omitempty"`
+
Separator struct {
Left struct {
Enabled bool `json:"enabled,omitempty"`
@@ -239,9 +284,13 @@ type MyConfig struct {
} `json:"simple-volume-pa,omitempty"`
NetIf struct {
- Enabled bool `json:"enabled,omitempty"`
- DownColor string `json:"down_color,omitempty"`
- UpColor string `json:"up_color,omitempty"`
+ Enabled bool `json:"enabled,omitempty"`
+ DownColor string `json:"down_color,omitempty"`
+ UpColor string `json:"up_color,omitempty"`
+ Color string `json:"color,omitempty"`
+ Background string `json:"background,omitempty"`
+ Font string `json:"font,omitempty"`
+ FontSize string `json:"font_size,omitempty"`
Separator struct {
Left struct {
@@ -320,7 +369,7 @@ type MyConfig struct {
// Conf global variable with application config.
var Conf MyConfig
-// readConf reads and validates confg if config does not exist, it puts default config to the same dir where i3 config
+// readConf reads and validates config if config does not exist, it puts default config to the same dir where i3 config
// is located.
func readConf() (MyConfig, error) {
var (
@@ -338,7 +387,8 @@ func readConf() (MyConfig, error) {
fileInfo, err := os.Stat(path)
- // Предполагаем, что файла либо нет, либо мы не можем его прочитать, второе надо бы логгировать, но пока забьём.
+ // Assume that either we unable to read file or file does not exit. We should mention second in logs but forget
+ // about it for now.
if err != nil {
if errors.Is(err, os.ErrNotExist) {
buf = DefaultConfig
@@ -350,7 +400,7 @@ func readConf() (MyConfig, error) {
return config, err
}
} else {
- // Конфиг-файл длинноват для конфига.
+ // Config file looks too long for config...
if fileInfo.Size() > 65535 {
err := fmt.Errorf("config file %s is too long for config", path) //nolint: goerr113
@@ -359,7 +409,6 @@ func readConf() (MyConfig, error) {
buf, err = os.ReadFile(path)
- // Не удалось прочитать
if err != nil {
err = fmt.Errorf("unable to read config file %s: %w", path, err)
@@ -406,6 +455,14 @@ func readConf() (MyConfig, error) {
sampleConfig.Background = "#edeceb"
}
+ if sampleConfig.Font == "" {
+ sampleConfig.Font = "Liberation Mono"
+ }
+
+ if sampleConfig.FontSize == "" {
+ sampleConfig.FontSize = "medium"
+ }
+
if sampleConfig.Separator.Left.Enabled {
if sampleConfig.Separator.Left.Color == "" {
sampleConfig.Separator.Left.Color = "#edeceb"
@@ -429,15 +486,23 @@ func readConf() (MyConfig, error) {
)
if err != nil {
- log.Printf("Unable to set sampleConfig.Separator.Left.FontSize: %s, fallback to medium", err)
+ log.Printf(
+ "Unable to set sampleConfig.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.FontSize,
+ )
- sampleConfig.Separator.Left.FontSize = "medium"
+ sampleConfig.Separator.Left.FontSize = sampleConfig.FontSize
}
if !matched {
- log.Printf("Unable to set sampleConfig.Separator.Left.FontSize: %s, fallback to medium", err)
+ log.Printf(
+ "Unable to set sampleConfig.Separator.Left.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.FontSize,
+ )
- sampleConfig.Separator.Left.FontSize = "medium"
+ sampleConfig.Separator.Left.FontSize = sampleConfig.FontSize
}
}
@@ -464,15 +529,22 @@ func readConf() (MyConfig, error) {
)
if err != nil {
- log.Printf("Unable to set sampleConfig.Separator.Right.FontSize: %s, fallback to medium", err)
+ log.Printf(
+ "Unable to set sampleConfig.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.FontSize,
+ )
- sampleConfig.Separator.Right.FontSize = "medium"
+ sampleConfig.Separator.Right.FontSize = sampleConfig.FontSize
}
if !matched {
- log.Printf("Unable to set sampleConfig.Separator.Right.FontSize: %s, fallback to medium", err)
+ log.Printf("Unable to set sampleConfig.Separator.Right.FontSize: %s, fallback to %s",
+ err,
+ sampleConfig.FontSize,
+ )
- sampleConfig.Separator.Right.FontSize = "medium"
+ sampleConfig.Separator.Right.FontSize = sampleConfig.FontSize
}
}
@@ -525,6 +597,22 @@ func readConf() (MyConfig, error) {
}
if sampleConfig.LA.Separator.Right.Enabled {
+ if sampleConfig.LA.Color == "" {
+ sampleConfig.LA.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.LA.Background == "" {
+ sampleConfig.LA.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.LA.Font == "" {
+ sampleConfig.LA.Font = sampleConfig.Font
+ }
+
+ if sampleConfig.LA.FontSize == "" {
+ sampleConfig.LA.FontSize = sampleConfig.FontSize
+ }
+
if sampleConfig.LA.Separator.Right.Color == "" {
sampleConfig.LA.Separator.Right.Color = sampleConfig.Separator.Right.Color
}
@@ -573,6 +661,22 @@ func readConf() (MyConfig, error) {
// sampleConfig.Mem will be false if not set in config
if sampleConfig.Mem.Enabled {
+ if sampleConfig.Mem.Color == "" {
+ sampleConfig.Mem.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.Mem.Background == "" {
+ sampleConfig.Mem.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.Mem.Font == "" {
+ sampleConfig.Mem.Font = sampleConfig.Font
+ }
+
+ if sampleConfig.Mem.FontSize == "" {
+ sampleConfig.Mem.FontSize = sampleConfig.FontSize
+ }
+
if sampleConfig.Mem.Separator.Left.Color == "" {
sampleConfig.Mem.Separator.Left.Color = sampleConfig.Separator.Left.Color
}
@@ -667,7 +771,19 @@ func readConf() (MyConfig, error) {
// sampleConfig.Clock.Enabled will be false if not set in config
if sampleConfig.Clock.Enabled {
if sampleConfig.Clock.Color == "" {
- sampleConfig.Clock.Color = "#666666"
+ sampleConfig.Clock.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.Clock.Background == "" {
+ sampleConfig.Clock.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.Clock.Font == "" {
+ sampleConfig.Clock.Font = sampleConfig.Font
+ }
+
+ if sampleConfig.Clock.FontSize == "" {
+ sampleConfig.Clock.FontSize = sampleConfig.FontSize
}
if sampleConfig.Clock.Separator.Left.Enabled {
@@ -761,117 +877,146 @@ func readConf() (MyConfig, error) {
}
}
}
- }
- // sampleConfig.Clock.LeftClick.Enabled will be false if not set in config
+ // sampleConfig.Clock.LeftClick.Enabled will be false if not set in config
- if len(sampleConfig.Clock.LeftClick.Cmd) == 0 {
- sampleConfig.Clock.LeftClick.Cmd = append(sampleConfig.Clock.LeftClick.Cmd, "true")
- }
+ if len(sampleConfig.Clock.LeftClick.Cmd) == 0 {
+ sampleConfig.Clock.LeftClick.Cmd = append(sampleConfig.Clock.LeftClick.Cmd, "true")
+ }
- // sampleConfig.Clock.RightClick.Enabled will be false if not set in config
+ // sampleConfig.Clock.RightClick.Enabled will be false if not set in config
- if len(sampleConfig.Clock.RightClick.Cmd) == 0 {
- sampleConfig.Clock.RightClick.Cmd = append(sampleConfig.Clock.RightClick.Cmd, "true")
+ if len(sampleConfig.Clock.RightClick.Cmd) == 0 {
+ sampleConfig.Clock.RightClick.Cmd = append(sampleConfig.Clock.RightClick.Cmd, "true")
+ }
}
// 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.Enabled {
+ if sampleConfig.Battery.Color == "" {
+ sampleConfig.Battery.Color = sampleConfig.Color
}
- if sampleConfig.Battery.Separator.Left.Background == "" {
- sampleConfig.Battery.Separator.Left.Background = sampleConfig.Separator.Left.Background
+ if sampleConfig.Battery.Background == "" {
+ sampleConfig.Battery.Background = sampleConfig.Background
}
- if sampleConfig.Battery.Separator.Left.Symbol == "" {
- sampleConfig.Battery.Separator.Left.Symbol = sampleConfig.Separator.Left.Symbol
+ if sampleConfig.Battery.Font == "" {
+ sampleConfig.Battery.Font = sampleConfig.Font
}
- if sampleConfig.Battery.Separator.Left.Font == "" {
- sampleConfig.Battery.Separator.Left.Font = sampleConfig.Separator.Left.Font
+ if sampleConfig.Battery.FontSize == "" {
+ sampleConfig.Battery.FontSize = sampleConfig.FontSize
}
- 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 sampleConfig.Battery.Symbol == "" {
+ sampleConfig.Battery.Symbol = "⚡"
+ }
- if err != nil {
- log.Printf(
- "Unable to set sampleConfig.Battery.Separator.Left.FontSize: %s, fallback to %s",
- err,
- sampleConfig.Separator.Left.FontSize,
- )
+ if sampleConfig.Battery.SymbolFont == "" {
+ sampleConfig.Battery.SymbolFont = sampleConfig.Battery.Font
+ }
- sampleConfig.Battery.Separator.Left.FontSize = sampleConfig.Separator.Left.FontSize
+ if sampleConfig.Battery.SymbolFontSize == "" {
+ sampleConfig.Battery.SymbolFontSize = sampleConfig.Battery.FontSize
+ }
+
+ // sampleConfig.Battery.ChargeColor.Full will be empty string if not set
+ // sampleConfig.Battery.ChargeColor.Empty will be empty string if not set
+ // sampleConfig.Battery.ChargeColor.AlmostFull will be empty string if not set
+ // sampleConfig.Battery.ChargeColor.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 !matched {
- log.Printf(
- "Unable to set sampleConfig.Battery.Separator.Left.FontSize, fallback to %s",
- sampleConfig.Separator.Left.FontSize,
+ 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,
)
- sampleConfig.Battery.Separator.Left.FontSize = sampleConfig.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
+ }
}
}
}
-
- 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
// No files configured - disable plugin
@@ -880,6 +1025,22 @@ func readConf() (MyConfig, error) {
}
if sampleConfig.CPUTemp.Enabled {
+ if sampleConfig.CPUTemp.Color == "" {
+ sampleConfig.CPUTemp.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.CPUTemp.Background == "" {
+ sampleConfig.CPUTemp.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.CPUTemp.Font == "" {
+ sampleConfig.CPUTemp.Font = sampleConfig.Font
+ }
+
+ if sampleConfig.CPUTemp.FontSize == "" {
+ sampleConfig.CPUTemp.FontSize = sampleConfig.FontSize
+ }
+
if sampleConfig.CPUTemp.Separator.Left.Enabled {
if sampleConfig.CPUTemp.Separator.Left.Color == "" {
sampleConfig.CPUTemp.Separator.Left.Color = sampleConfig.Separator.Left.Color
@@ -979,11 +1140,27 @@ func readConf() (MyConfig, error) {
}
if sampleConfig.Vpn.Enabled {
+ if sampleConfig.Vpn.Color == "" {
+ sampleConfig.Vpn.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.Vpn.Background == "" {
+ sampleConfig.Vpn.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.Vpn.Font == "" {
+ sampleConfig.Vpn.FontSize = sampleConfig.Font
+ }
+
+ if sampleConfig.Vpn.FontSize == "" {
+ sampleConfig.Vpn.FontSize = sampleConfig.FontSize
+ }
+
// 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
}
// sampleConfig.Vpn.DownColor will be empty string if no value set in config
@@ -1109,16 +1286,34 @@ func readConf() (MyConfig, error) {
}
}
- // TODO: appbuttons, etc..
// sampleConfig.SimpleVolumePa.Enabled will false if not set in config
-
if sampleConfig.SimpleVolumePa.Enabled {
+ if sampleConfig.SimpleVolumePa.Color == "" {
+ sampleConfig.SimpleVolumePa.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.SimpleVolumePa.Background == "" {
+ sampleConfig.SimpleVolumePa.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.SimpleVolumePa.Font == "" {
+ sampleConfig.SimpleVolumePa.Font = sampleConfig.Font
+ }
+
+ if sampleConfig.SimpleVolumePa.FontSize == "" {
+ sampleConfig.SimpleVolumePa.FontSize = sampleConfig.FontSize
+ }
+
if sampleConfig.SimpleVolumePa.Symbol == "" {
sampleConfig.SimpleVolumePa.Symbol = `🔊`
}
- if sampleConfig.SimpleVolumePa.FontSize == "" {
- sampleConfig.SimpleVolumePa.FontSize = "medium"
+ if sampleConfig.SimpleVolumePa.SymbolFont == "" {
+ sampleConfig.SimpleVolumePa.SymbolFont = sampleConfig.SimpleVolumePa.Font
+ }
+
+ if sampleConfig.SimpleVolumePa.SymbolFontSize == "" {
+ sampleConfig.SimpleVolumePa.SymbolFontSize = sampleConfig.SimpleVolumePa.FontSize
}
if sampleConfig.SimpleVolumePa.Step == 0 {
@@ -1264,6 +1459,22 @@ func readConf() (MyConfig, error) {
sampleConfig.NetIf.UpColor = "green"
}
+ if sampleConfig.NetIf.Color == "" {
+ sampleConfig.NetIf.Color = sampleConfig.Color
+ }
+
+ if sampleConfig.NetIf.Background == "" {
+ sampleConfig.NetIf.Background = sampleConfig.Background
+ }
+
+ if sampleConfig.NetIf.Font == "" {
+ sampleConfig.NetIf.Font = sampleConfig.Font
+ }
+
+ if sampleConfig.NetIf.FontSize == "" {
+ sampleConfig.NetIf.FontSize = sampleConfig.FontSize
+ }
+
if sampleConfig.NetIf.Separator.Left.Enabled {
if sampleConfig.NetIf.Separator.Left.Color == "" {
sampleConfig.NetIf.Separator.Left.Color = sampleConfig.Separator.Left.Color
diff --git a/i3status-go-example.json b/i3status-go-example.json
index 7e67591..12b5ca0 100644
--- a/i3status-go-example.json
+++ b/i3status-go-example.json
@@ -5,30 +5,53 @@
// Default backbround color. If not set value of #edeceb is used.
"background" : "#000000",
+// Can be omitted, then Liberation Mono will be used.
+"font": "Liberation Mono",
+
+// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+// ‘smaller’ or ‘larger’
+"font_size": "medium",
+
"separator" : {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to #edeceb color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to #3e78fd background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to "|" (no quotes) symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to "Noto Sans" font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
- // False if value omitted
+ // Set to false if omitted.
"enabled": true,
- // Used #edeceb as default if value omitted
+
+ // If omitted set to #edeceb color defined for separator up here.
"color": "#3e78fd",
- // If not set #3e78fd is used.
+
+ // If omitted set to #3e78fd background color defined for separator up here.
"background": "#000000",
- // If omitted, used "|" (no quotes) as default
+
+ // If omitted set to "|" (no quotes) symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to "Noto Sans" font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
},
@@ -36,28 +59,64 @@
// Memory stats
"mem" : {
"enabled": true,
+
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // Do we show used swap megs?
"show_swap": false,
+ // Re-define separator parameters for net-if block here.
"separator" : {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
}
@@ -67,26 +126,60 @@
"la" : {
"enabled": true,
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // Re-define separator parameters for net-if block here.
"separator" : {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
}
@@ -94,29 +187,67 @@
"net-if" : {
"enabled" : false,
- // In html notation
+
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // Net interface down symbol color, in html notation.
"down_color" : "red",
+
+ // Net interface up symbol color, in html notation.
"up_color" : "green",
- "separator" : {
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
+ "background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
},
@@ -125,47 +256,89 @@
{
// 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
+// 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,
+
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // Status file location. Plugin will be disabled if this value omitted.
"statusfile" : "/tmp/openvpn-status.stat",
+
+ // mtime check period.
"mtime_threshold": 10,
- // Color in html notation
+
+ // Vpn down symbol color, in html notation.
"down_color" : "red",
+
+ // Vpn up symbol color, in html notation.
"up_color" : "green",
- "separator" : {
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
},
- // Also we can tcp-ping some service inside vpn network to ensure that connection is not stoned
+ // Also we can tcp-ping some service inside vpn network to ensure that connection is not stoned.
"tcp_check" : {
"enabled": false,
"host": "somehost.tld",
@@ -177,11 +350,25 @@
// Simple sound volume indicator
"simple-volume-pa": {
"enabled": false,
+
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
"symbol": "🔊",
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of the relative sizes
- // ‘smaller’ or ‘larger’. If omitted set to medium by default.
- "font_size": "medium",
+ // ‘smaller’ or ‘larger’. If omitted set to value of simple-volume-pa.font_size by default.
+ "symbol_font_size": "medium",
// If not defined - will be "true"
"right_click_cmd": ["pavucontrol"],
@@ -199,26 +386,47 @@
// Maximum sound volume, can be over 100%, but sould not be :) Default value 100 if not set.
"max_volume_limit": 120,
- "separator" : {
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
- // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’,, or one of the relative sizes
- // ‘smaller’ or ‘larger’
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
- // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of the relative sizes
- // ‘smaller’ or ‘larger’
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
}
@@ -227,29 +435,61 @@
// Just clock
"clock": {
"enabled" : true,
- // Text color in html (actually, pango) notation
- "color" : "#666666",
- "separator" : {
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
},
@@ -270,7 +510,30 @@
"battery": {
"enabled": false,
- "color": {
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // If omitted "⚡" (no quotes) is used.
+ "symbol": "⚡",
+
+ // If omitted battery.font is used.
+ "symbol_font" : "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of the relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to value of simple-volume-pa.font_size by default.
+ "symbol_font_size": "large",
+
+ "charge_color": {
// colors in html notation
"full": "green",
"empty": "red",
@@ -278,26 +541,47 @@
"almost_empty": "orange"
},
- "separator" : {
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
}
@@ -307,26 +591,60 @@
"cpu_temp": {
"enabled": false,
- "separator" : {
+ // If omitted set to default color defined up here.
+ "color": "#3e78fd",
+
+ // If omitted set to default background color defined up here.
+ "background": "#000000",
+
+ // If omitted set to default font defined up here.
+ "font": "Noto Sans",
+
+ // ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
+ "font_size": "medium",
+
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
"background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
},
@@ -367,31 +685,54 @@
]
},
-// Weather to display Application Buttons
+// Whether to display Application Buttons.
"app_buttons": {
"enabled": true,
- "separator" : {
+ // Re-define separator parameters for net-if block here.
+ "separator": {
"left": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
+ "background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "▶",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
},
"right": {
+ // Set to false if omitted.
"enabled": true,
+
+ // If omitted set to default color defined for separator up here.
"color": "#3e78fd",
+
+ // If omitted set to default background color defined for separator up here.
+ "background": "#000000",
+
+ // If omitted set to default symbol defined for separator up here.
"symbol": "◀",
+
+ // If omitted set to default font defined for separator up here.
"font": "Noto Sans",
+
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
- // ‘smaller’ or ‘larger’
+ // ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
"font_size": "medium"
}
- }
+ },
},
// Buttons - application launch "buttons"
diff --git a/main.go b/main.go
index fd49a7b..fb936d7 100644
--- a/main.go
+++ b/main.go
@@ -179,6 +179,9 @@ func main() {
if Conf.CPUTemp.Enabled {
var b I3BarOutBlock
+ b.Color = Conf.CPUTemp.Color
+ b.Background = Conf.CPUTemp.Background
+
if Conf.CPUTemp.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
"%s",
@@ -189,7 +192,12 @@ func main() {
)
}
- b.FullText += fmt.Sprintf("CPU: %d°", CPUTemperature)
+ b.FullText += fmt.Sprintf(
+ "CPU: %d°",
+ Conf.CPUTemp.Font,
+ Conf.CPUTemp.FontSize,
+ CPUTemperature,
+ )
if Conf.CPUTemp.Separator.Right.Enabled {
b.FullText += fmt.Sprintf(
@@ -210,6 +218,9 @@ func main() {
if Conf.Mem.Enabled {
var b I3BarOutBlock
+ b.Color = Conf.Mem.Color
+ b.Background = Conf.Mem.Background
+
if Conf.Mem.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
"%s",
@@ -221,9 +232,22 @@ func main() {
}
if Conf.Mem.ShowSwap {
- b.FullText += fmt.Sprintf("M:%d%% SHM:%dM SW:%dM", Memory.Usedpct, Memory.Shared, Memory.Swap)
+ b.FullText += fmt.Sprintf(
+ "M:%d%% SHM:%dM SW:%dM",
+ Conf.Mem.Font,
+ Conf.Mem.FontSize,
+ Memory.Usedpct,
+ Memory.Shared,
+ Memory.Swap,
+ )
} else {
- b.FullText += fmt.Sprintf("M:%d%% SHM:%dM", Memory.Usedpct, Memory.Shared)
+ b.FullText += fmt.Sprintf(
+ "M:%d%% SHM:%dM",
+ Conf.Mem.Font,
+ Conf.Mem.FontSize,
+ Memory.Usedpct,
+ Memory.Shared,
+ )
}
if Conf.Mem.Separator.Right.Enabled {
@@ -245,6 +269,9 @@ func main() {
if Conf.LA.Enabled {
var b I3BarOutBlock
+ b.Color = Conf.LA.Color
+ b.Background = Conf.LA.Background
+
if Conf.LA.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
"%s",
@@ -255,7 +282,12 @@ func main() {
)
}
- b.FullText += fmt.Sprintf("LA: %s", La)
+ b.FullText += fmt.Sprintf(
+ "LA:%s",
+ Conf.LA.Font,
+ Conf.LA.FontSize,
+ La,
+ )
if Conf.LA.Separator.Right.Enabled {
b.FullText += fmt.Sprintf(
@@ -276,6 +308,9 @@ func main() {
if Conf.NetIf.Enabled {
var b I3BarOutBlock
+ b.Color = Conf.NetIf.Color
+ b.Background = Conf.NetIf.Background
+
if Conf.NetIf.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
"%s",
@@ -286,7 +321,12 @@ func main() {
)
}
- b.FullText += IfStatus
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.NetIf.Font,
+ Conf.NetIf.FontSize,
+ IfStatus,
+ )
if Conf.NetIf.Separator.Right.Enabled {
b.FullText += fmt.Sprintf(
@@ -307,6 +347,9 @@ func main() {
if Conf.Vpn.Enabled {
var b I3BarOutBlock
+ b.Color = Conf.Vpn.Color
+ b.Background = Conf.Vpn.Background
+
if Conf.Vpn.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
"%s",
@@ -317,7 +360,12 @@ func main() {
)
}
- b.FullText += VPNStatus
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.Vpn.Font,
+ Conf.Vpn.FontSize,
+ VPNStatus,
+ )
if Conf.Vpn.Separator.Right.Enabled {
b.FullText += fmt.Sprintf(
@@ -338,6 +386,9 @@ func main() {
if Conf.Battery.Enabled {
var b I3BarOutBlock
+ b.Color = Conf.Battery.Color
+ b.Background = Conf.Battery.Background
+
if Conf.Battery.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
"%s",
@@ -368,7 +419,10 @@ func main() {
if Conf.SimpleVolumePa.Enabled {
var b I3BarOutBlock
+
b.Name = "simple-volume-pa"
+ b.Color = Conf.SimpleVolumePa.Color
+ b.Background = Conf.SimpleVolumePa.Background
if Conf.SimpleVolumePa.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
@@ -380,6 +434,7 @@ func main() {
)
}
+ // Pango format is already applied in plugin src.
b.FullText += SoundVolume
if Conf.SimpleVolumePa.Separator.Right.Enabled {
@@ -400,7 +455,10 @@ func main() {
if Conf.Clock.Enabled {
var b I3BarOutBlock
+
b.Name = `wallclock`
+ b.Color = Conf.Clock.Color
+ b.Background = Conf.Clock.Background
if Conf.Clock.Separator.Left.Enabled {
b.FullText = fmt.Sprintf(
@@ -412,7 +470,12 @@ func main() {
)
}
- b.FullText += Clock
+ b.FullText += fmt.Sprintf(
+ "%s",
+ Conf.Clock.Font,
+ Conf.Clock.FontSize,
+ Clock,
+ )
if Conf.Clock.Separator.Right.Enabled {
b.FullText += fmt.Sprintf(
@@ -425,7 +488,6 @@ func main() {
}
b.Markup = "pango"
- b.Color = Conf.Clock.Color
b.Separator = false
j = append(j, b)
diff --git a/pulseaudio.go b/pulseaudio.go
index cacbd78..2ff8ce4 100644
--- a/pulseaudio.go
+++ b/pulseaudio.go
@@ -36,16 +36,19 @@ func UpdateVolumeInfo() {
}
SoundVolume = fmt.Sprintf(
- "%s:%d%%",
- Conf.SimpleVolumePa.FontSize,
+ "%s:%d%%",
+ Conf.SimpleVolumePa.SymbolFont,
+ Conf.SimpleVolumePa.SymbolFontSize,
Conf.SimpleVolumePa.Symbol,
+ Conf.SimpleVolumePa.Font,
+ Conf.SimpleVolumePa.FontSize,
int64(vol*100),
)
UpdateReady <- true
for {
- // Subscribe to update notification channel, to get info that volume changed
+ // Subscribe to update notification channel, to get info that volume changed.
pulseUpdate, err := pa.Updates()
if err != nil {
@@ -65,9 +68,12 @@ func UpdateVolumeInfo() {
}
SoundVolume = fmt.Sprintf(
- "%s:%d%%",
- Conf.SimpleVolumePa.FontSize,
+ "%s:%d%%",
+ Conf.SimpleVolumePa.SymbolFont,
+ Conf.SimpleVolumePa.SymbolFontSize,
Conf.SimpleVolumePa.Symbol,
+ Conf.SimpleVolumePa.Font,
+ Conf.SimpleVolumePa.FontSize,
int64(vol*100),
)
@@ -89,7 +95,7 @@ func UpdateVolumeInfo() {
func PaReinit() error {
var err error
- // If we out of updates, it seems that someone killed pulseaudio server. Restart it.
+ // If we out of updates, seems someone killed pulseaudio server. Restart it.
cmd := exec.Command("pulseaudio", "--check")
if err := cmd.Run(); err == nil {
diff --git a/spawn.go b/spawn.go
index 9eed184..b3ef0de 100644
--- a/spawn.go
+++ b/spawn.go
@@ -53,6 +53,7 @@ func CleanZombies() {
for {
_, _ = syscall.Wait4(-1, nil, 0, &r)
+
time.Sleep(1 * time.Minute)
}
}