From f2f6f64d1157f04f6d7aeae8db247b704ee16e65 Mon Sep 17 00:00:00 2001 From: eleksir Date: Thu, 11 Jan 2024 00:25:36 +0300 Subject: [PATCH] Fix separator behaviour, add comment to sample config, remove caps_lock-related fields as this is not implemented --- i3status-go-example.json | 25 +++++++++++++------------ main.go | 11 ++++++++++- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/i3status-go-example.json b/i3status-go-example.json index 8ac8970..70da3e3 100644 --- a/i3status-go-example.json +++ b/i3status-go-example.json @@ -10,8 +10,8 @@ // Memory stats "mem" : { - "enabled": true, - "show_swap": false + "enabled": true, + "show_swap": false }, // Just clock @@ -19,11 +19,13 @@ "enabled" : true, // Text color in html (actually, pango) notation "color" : "#666666", + "left_click" : { "enabled" : false, // cmd is array of command itself and its arguments "cmd" : [ "orage" ] }, + "right_click" : { "enabled" : false, "cmd" : [ "true" ] @@ -33,6 +35,7 @@ // Battery, useful for laptops "battery": { "enabled": false, + "color": { // colors in html notation "full": "green", @@ -45,6 +48,7 @@ // CPU Temperature monitor, shows average value among given sources "cpu_temp": { "enabled": false, + // Files in sysfs that contains cpu temperatures "file": [ "/sys/class/hwmon/hwmon4/temp2_input", @@ -56,14 +60,6 @@ ] }, -// Caps Lock status -"capslock": { - "enabled" : false, - // Colors in html notation - "background" : "#000000", - "color" : "#3e78fd" -}, - // 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": { @@ -74,6 +70,7 @@ "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", @@ -104,6 +101,7 @@ // In html notation "down_color" : "red", "up_color" : "green", + "if" : [ { // Name as it displayed on i3bar @@ -119,6 +117,7 @@ // such user session services. "cron" : { "enabled" : false, + "tasks" : [ { // Time in crontab notation @@ -158,12 +157,14 @@ "class": "^Thunar$", // text color in html notation "color": "#ffa500", - // background color in html notation - "background" : "#000000", + // background color in html notation + "background" : "#000000", // border color in html notation "border": "#666666", // border color if there is at least one window with given Instance and/or Class exist "border_active": "#3e78fd", + // Vertical line between objects on bar - if omitted true value is assumed by i3bar, but we set it to false + // in that case. It is limitation of golang json parser. "separator": false, "separator_block_width": 2 }, diff --git a/main.go b/main.go index bf0b2d4..e13ae84 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ type I3BarOutBlock struct { Name string `json:"name,omitempty"` Instance string `json:"instance,omitempty"` Urgent bool `json:"urgent,omitempty"` - Separator bool `json:"separator,omitempty"` + Separator bool `json:"separator"` SeparatorBlockWidth int `json:"separator_block_width,omitempty"` Markup string `json:"markup,omitempty"` } @@ -157,6 +157,7 @@ func main() { if Conf.CPUTemp.Enabled { var b I3BarOutBlock b.FullText = fmt.Sprintf("CPU: %d°", CPUTemperature) + b.Separator = true j = append(j, b) } @@ -169,12 +170,15 @@ func main() { b.FullText = fmt.Sprintf("M:%d%% SHM:%dM", Memory.Usedpct, Memory.Shared) } + b.Separator = true + j = append(j, b) } if Conf.LA { var b I3BarOutBlock b.FullText = fmt.Sprintf("La: %s", La) + b.Separator = true j = append(j, b) } @@ -182,6 +186,7 @@ func main() { var b I3BarOutBlock b.FullText = IfStatus b.Markup = "pango" + b.Separator = true j = append(j, b) } @@ -189,12 +194,14 @@ func main() { var b I3BarOutBlock b.FullText = VPNStatus b.Markup = "pango" + b.Separator = true j = append(j, b) } if Conf.Battery.Enabled { var b I3BarOutBlock b.FullText = Batt + b.Separator = true j = append(j, b) } @@ -203,6 +210,7 @@ func main() { b.Name = "simple-volume-pa" b.FullText = SoundVolume b.Markup = "pango" + b.Separator = true j = append(j, b) } @@ -212,6 +220,7 @@ func main() { b.FullText = Clock b.Markup = "pango" b.Color = Conf.Clock.Color + b.Separator = true j = append(j, b) }