xmtop/src/widgets/temp_windows.go

19 lines
384 B
Go
Raw Normal View History

2018-05-16 04:48:26 +08:00
package widgets
import (
psHost "github.com/shirou/gopsutil/host"
)
func (self *Temp) update() {
sensors, _ := psHost.SensorsTemperatures()
for _, sensor := range sensors {
2018-11-30 09:37:41 +08:00
if sensor.Temperature != 0 {
if self.Fahrenheit {
self.Data[sensor.SensorKey] = int(sensor.Temperature*9/5 + 32)
} else {
self.Data[sensor.SensorKey] = int(sensor.Temperature)
}
2018-11-30 09:37:41 +08:00
}
2018-05-16 04:48:26 +08:00
}
}