3 Commits
v1.6 ... v1.7

Author SHA1 Message Date
eleksir
12f4dc75f0 Fix linter warnings 2025-06-24 16:13:36 +03:00
eleksir
913fcc34ee Fix incorrect display measurement units in swap calculation in mem plugin 2025-06-24 16:12:48 +03:00
eleksir
ac856f4174 Fix empty font name and incorrect font size name in VPN plugin output 2025-06-24 16:11:43 +03:00
4 changed files with 15 additions and 10 deletions

View File

@@ -29,7 +29,7 @@ func (c *MyConfig) UpdateBatteryInfo() {
}
var (
batteries []*battery.Battery = []*battery.Battery{}
batteries = []*battery.Battery{}
Batts string
ch int
status string
@@ -52,6 +52,7 @@ func (c *MyConfig) UpdateBatteryInfo() {
if err != nil {
log.Printf("Unable to read file %s: %s", file, err)
continue
}
@@ -65,6 +66,7 @@ func (c *MyConfig) UpdateBatteryInfo() {
if err != nil {
log.Printf("Unable to read file %s: %s", statusFile, err)
continue
}
@@ -91,6 +93,7 @@ func (c *MyConfig) UpdateBatteryInfo() {
if err != nil {
log.Printf("Unable to convert string from file %s to integer", file)
continue
}
@@ -100,9 +103,9 @@ func (c *MyConfig) UpdateBatteryInfo() {
}
}
} else {
batteries, _ = battery.GetAll()
// In theory, this module should give for each entry its separate err, but in practice it gives
// one single err for all entries, so we cannot detemine whist exatly entry errored.
batteries, _ = battery.GetAll()
}
var (

View File

@@ -1049,7 +1049,7 @@ func ReadConf(defaultConfig []byte) (*MyConfig, error) {
}
if sampleConfig.Vpn.Font == "" {
sampleConfig.Vpn.FontSize = sampleConfig.Font
sampleConfig.Vpn.Font = sampleConfig.Font
}
if sampleConfig.Vpn.FontSize == "" {
@@ -1463,6 +1463,7 @@ func ReadConf(defaultConfig []byte) (*MyConfig, error) {
if sampleConfig.CmdRun.Cmd == "" && sampleConfig.CmdRun.Enabled {
sampleConfig.CmdRun.Enabled = false
log.Print(
"Setting sampleConfig.CmdRun.Enabled to false because sampleConfig.CmdRun.Cmd is not set",
)

View File

@@ -51,7 +51,7 @@ func (c *MyConfig) UpdateMemStats() {
if c.Values.Memory.Usedpct != uint64(v.UsedPercent) || c.Values.Memory.Shared != v.Shared/1024/1024 || c.Values.Memory.Swap != v.SwapTotal-v.SwapFree {
c.Values.Memory.Usedpct = uint64(v.UsedPercent)
c.Values.Memory.Shared = v.Shared / 1024 / 1024
c.Values.Memory.Swap = sw.Used
c.Values.Memory.Swap = sw.Used / 1024 / 1024
c.Channels.UpdateReady <- true
}
} else {

View File

@@ -14,6 +14,7 @@ import (
func (c *MyConfig) Spawner() {
for prg := range c.Channels.RunChan {
<-time.After(25 * time.Millisecond)
devnullR, _ := os.Open(os.DevNull)
devnullW, _ := os.OpenFile(os.DevNull, os.O_WRONLY|os.O_APPEND, 0644)
@@ -68,9 +69,9 @@ func RunProcess(command []string) string {
switch len(command) {
case 1:
cmd = exec.Command(command[0], "")
cmd = exec.Command(command[0], "") //nolint: gosec
default:
cmd = exec.Command(command[0], command[1:]...)
cmd = exec.Command(command[0], command[1:]...) //nolint: gosec
}
cmd.Dir = "/"
@@ -87,11 +88,11 @@ func RunProcess(command []string) string {
}
return ""
} else {
}
if stderr.String() != "" {
log.Printf("%s: %s", strings.Join(command, " "), stderr.String())
}
}
return strings.TrimRight(stdout.String(), "\n")
}