Fix separator behaviour, add comment to sample config, remove caps_lock-related fields as this is not implemented

This commit is contained in:
eleksir
2024-01-11 00:25:36 +03:00
parent aa55cb6a1b
commit f2f6f64d11
2 changed files with 23 additions and 13 deletions

View File

@@ -19,11 +19,13 @@
"enabled" : true, "enabled" : true,
// Text color in html (actually, pango) notation // Text color in html (actually, pango) notation
"color" : "#666666", "color" : "#666666",
"left_click" : { "left_click" : {
"enabled" : false, "enabled" : false,
// cmd is array of command itself and its arguments // cmd is array of command itself and its arguments
"cmd" : [ "orage" ] "cmd" : [ "orage" ]
}, },
"right_click" : { "right_click" : {
"enabled" : false, "enabled" : false,
"cmd" : [ "true" ] "cmd" : [ "true" ]
@@ -33,6 +35,7 @@
// Battery, useful for laptops // Battery, useful for laptops
"battery": { "battery": {
"enabled": false, "enabled": false,
"color": { "color": {
// colors in html notation // colors in html notation
"full": "green", "full": "green",
@@ -45,6 +48,7 @@
// CPU Temperature monitor, shows average value among given sources // CPU Temperature monitor, shows average value among given sources
"cpu_temp": { "cpu_temp": {
"enabled": false, "enabled": false,
// Files in sysfs that contains cpu temperatures // Files in sysfs that contains cpu temperatures
"file": [ "file": [
"/sys/class/hwmon/hwmon4/temp2_input", "/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 // 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 // state file and *update* its timestamp at least as frequent as mtime_threshold in seconds
"vpn": { "vpn": {
@@ -74,6 +70,7 @@
"down_color" : "red", "down_color" : "red",
"up_color" : "green", "up_color" : "green",
// 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" : { "tcp_check" : {
"enabled": false, "enabled": false,
"host": "somehost.tld", "host": "somehost.tld",
@@ -104,6 +101,7 @@
// In html notation // In html notation
"down_color" : "red", "down_color" : "red",
"up_color" : "green", "up_color" : "green",
"if" : [ "if" : [
{ {
// Name as it displayed on i3bar // Name as it displayed on i3bar
@@ -119,6 +117,7 @@
// such user session services. // such user session services.
"cron" : { "cron" : {
"enabled" : false, "enabled" : false,
"tasks" : [ "tasks" : [
{ {
// Time in crontab notation // Time in crontab notation
@@ -164,6 +163,8 @@
"border": "#666666", "border": "#666666",
// border color if there is at least one window with given Instance and/or Class exist // border color if there is at least one window with given Instance and/or Class exist
"border_active": "#3e78fd", "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": false,
"separator_block_width": 2 "separator_block_width": 2
}, },

11
main.go
View File

@@ -29,7 +29,7 @@ type I3BarOutBlock struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Instance string `json:"instance,omitempty"` Instance string `json:"instance,omitempty"`
Urgent bool `json:"urgent,omitempty"` Urgent bool `json:"urgent,omitempty"`
Separator bool `json:"separator,omitempty"` Separator bool `json:"separator"`
SeparatorBlockWidth int `json:"separator_block_width,omitempty"` SeparatorBlockWidth int `json:"separator_block_width,omitempty"`
Markup string `json:"markup,omitempty"` Markup string `json:"markup,omitempty"`
} }
@@ -157,6 +157,7 @@ func main() {
if Conf.CPUTemp.Enabled { if Conf.CPUTemp.Enabled {
var b I3BarOutBlock var b I3BarOutBlock
b.FullText = fmt.Sprintf("CPU: %d°", CPUTemperature) b.FullText = fmt.Sprintf("CPU: %d°", CPUTemperature)
b.Separator = true
j = append(j, b) j = append(j, b)
} }
@@ -169,12 +170,15 @@ func main() {
b.FullText = fmt.Sprintf("M:%d%% SHM:%dM", Memory.Usedpct, Memory.Shared) b.FullText = fmt.Sprintf("M:%d%% SHM:%dM", Memory.Usedpct, Memory.Shared)
} }
b.Separator = true
j = append(j, b) j = append(j, b)
} }
if Conf.LA { if Conf.LA {
var b I3BarOutBlock var b I3BarOutBlock
b.FullText = fmt.Sprintf("La: %s", La) b.FullText = fmt.Sprintf("La: %s", La)
b.Separator = true
j = append(j, b) j = append(j, b)
} }
@@ -182,6 +186,7 @@ func main() {
var b I3BarOutBlock var b I3BarOutBlock
b.FullText = IfStatus b.FullText = IfStatus
b.Markup = "pango" b.Markup = "pango"
b.Separator = true
j = append(j, b) j = append(j, b)
} }
@@ -189,12 +194,14 @@ func main() {
var b I3BarOutBlock var b I3BarOutBlock
b.FullText = VPNStatus b.FullText = VPNStatus
b.Markup = "pango" b.Markup = "pango"
b.Separator = true
j = append(j, b) j = append(j, b)
} }
if Conf.Battery.Enabled { if Conf.Battery.Enabled {
var b I3BarOutBlock var b I3BarOutBlock
b.FullText = Batt b.FullText = Batt
b.Separator = true
j = append(j, b) j = append(j, b)
} }
@@ -203,6 +210,7 @@ func main() {
b.Name = "simple-volume-pa" b.Name = "simple-volume-pa"
b.FullText = SoundVolume b.FullText = SoundVolume
b.Markup = "pango" b.Markup = "pango"
b.Separator = true
j = append(j, b) j = append(j, b)
} }
@@ -212,6 +220,7 @@ func main() {
b.FullText = Clock b.FullText = Clock
b.Markup = "pango" b.Markup = "pango"
b.Color = Conf.Clock.Color b.Color = Conf.Clock.Color
b.Separator = true
j = append(j, b) j = append(j, b)
} }