From 5770f9106e6dd844ba558ed844886fa85fd4695c Mon Sep 17 00:00:00 2001 From: eleksir Date: Tue, 16 Jan 2024 21:59:04 +0300 Subject: [PATCH] Explicitly set color and background attributes for all tags --- batteries.go | 52 ++++++++++++++++++++++++++++++++++----------------- main.go | 28 ++++++++++++++++++++------- pulseaudio.go | 10 +++++++++- 3 files changed, 65 insertions(+), 25 deletions(-) diff --git a/batteries.go b/batteries.go index 7510bb4..88887ec 100644 --- a/batteries.go +++ b/batteries.go @@ -57,17 +57,20 @@ func UpdateBatteryInfo() { case ch > 85: if Conf.Battery.ChargeColor.Full == "" { chStr = fmt.Sprintf( - "% 3d%%", + "% 3d%%", + Conf.Battery.Color, + Conf.Battery.Background, + Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.Full, ch, ) } else { chStr = fmt.Sprintf( - `% 3d%%`, + `% 3d%%`, + Conf.Battery.ChargeColor.Full, + Conf.Battery.Background, Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.Full, ch, ) } @@ -75,17 +78,20 @@ func UpdateBatteryInfo() { case ch < 85 && ch > 40: if Conf.Battery.ChargeColor.AlmostFull == "" { chStr = fmt.Sprintf( - "% 3d%%", + "% 3d%%", + Conf.Battery.Color, + Conf.Battery.Background, + Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.Full, ch, ) } else { chStr = fmt.Sprintf( - `% 3d%%`, + `% 3d%%`, + Conf.Battery.ChargeColor.AlmostFull, + Conf.Battery.Background, Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.AlmostFull, ch, ) } @@ -93,17 +99,20 @@ func UpdateBatteryInfo() { case ch <= 40 && ch >= 10: if Conf.Battery.ChargeColor.AlmostEmpty == "" { chStr = fmt.Sprintf( - "% 3d%%", + "% 3d%%", + Conf.Battery.Color, + Conf.Battery.Background, + Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.Full, ch, ) } else { chStr = fmt.Sprintf( - `% 3d%%`, + `% 3d%%`, + Conf.Battery.ChargeColor.AlmostEmpty, + Conf.Battery.Background, Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.AlmostEmpty, ch, ) } @@ -111,31 +120,40 @@ func UpdateBatteryInfo() { case ch < 10: if Conf.Battery.ChargeColor.Empty == "" { chStr = fmt.Sprintf( - "% 3d%%", + "% 3d%%", + Conf.Battery.Color, + Conf.Battery.Background, + Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.Full, ch, ) } else { chStr = fmt.Sprintf( - `% 3d%%`, + `% 3d%%`, + Conf.Battery.ChargeColor.Empty, + Conf.Battery.Background, Conf.Battery.Font, Conf.Battery.FontSize, - Conf.Battery.ChargeColor.Empty, ch, ) } } battsInfo += fmt.Sprintf( - "%sB%d %s %s", + "%sB%d %s %s", + Conf.Battery.Color, + Conf.Battery.Background, Conf.Battery.SymbolFont, Conf.Battery.SymbolFontSize, Conf.Battery.Symbol, + Conf.Battery.Color, + Conf.Battery.Background, Conf.Battery.Font, Conf.Battery.FontSize, i, chStr, + Conf.Battery.Color, + Conf.Battery.Background, Conf.Battery.Font, Conf.Battery.FontSize, status, diff --git a/main.go b/main.go index 43aed20..28b465b 100644 --- a/main.go +++ b/main.go @@ -198,7 +198,9 @@ func main() { } b.FullText += fmt.Sprintf( - "CPU: %d°", + "CPU: %d°", + Conf.CPUTemp.Color, + Conf.CPUTemp.Background, Conf.CPUTemp.Font, Conf.CPUTemp.FontSize, CPUTemperature, @@ -238,7 +240,9 @@ func main() { if Conf.Mem.ShowSwap { b.FullText += fmt.Sprintf( - "M:%d%% SHM:%dM SW:%dM", + "M:%d%% SHM:%dM SW:%dM", + Conf.Mem.Color, + Conf.Mem.Background, Conf.Mem.Font, Conf.Mem.FontSize, Memory.Usedpct, @@ -247,7 +251,9 @@ func main() { ) } else { b.FullText += fmt.Sprintf( - "M:%d%% SHM:%dM", + "M:%d%% SHM:%dM", + Conf.Mem.Color, + Conf.Mem.Background, Conf.Mem.Font, Conf.Mem.FontSize, Memory.Usedpct, @@ -288,7 +294,9 @@ func main() { } b.FullText += fmt.Sprintf( - "LA:%s", + "LA:%s", + Conf.LA.Color, + Conf.LA.Background, Conf.LA.Font, Conf.LA.FontSize, La, @@ -327,7 +335,9 @@ func main() { } b.FullText += fmt.Sprintf( - "%s", + "%s", + Conf.NetIf.Color, + Conf.NetIf.Background, Conf.NetIf.Font, Conf.NetIf.FontSize, IfStatus, @@ -366,7 +376,9 @@ func main() { } b.FullText += fmt.Sprintf( - "%s", + "%s", + Conf.Vpn.Color, + Conf.Vpn.Background, Conf.Vpn.Font, Conf.Vpn.FontSize, VPNStatus, @@ -476,7 +488,9 @@ func main() { } b.FullText += fmt.Sprintf( - "%s", + "%s", + Conf.Clock.Color, + Conf.Clock.Background, Conf.Clock.Font, Conf.Clock.FontSize, Clock, diff --git a/pulseaudio.go b/pulseaudio.go index 2ff8ce4..4de038f 100644 --- a/pulseaudio.go +++ b/pulseaudio.go @@ -68,10 +68,18 @@ func UpdateVolumeInfo() { } SoundVolume = fmt.Sprintf( - "%s:%d%%", + "%s", + Conf.SimpleVolumePa.Color, + Conf.SimpleVolumePa.Background, Conf.SimpleVolumePa.SymbolFont, Conf.SimpleVolumePa.SymbolFontSize, Conf.SimpleVolumePa.Symbol, + ) + + SoundVolume += fmt.Sprintf( + ":%d%%", + Conf.SimpleVolumePa.Color, + Conf.SimpleVolumePa.Background, Conf.SimpleVolumePa.Font, Conf.SimpleVolumePa.FontSize, int64(vol*100),