xmtop/src/widgets/temp_windows.go

20 lines
440 B
Go
Raw Normal View History

2018-05-16 04:48:26 +08:00
package widgets
import (
"github.com/cjbassi/gotop/src/utils"
2018-05-16 04:48:26 +08:00
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] = utils.CelsiusToFahrenheit(int(sensor.Temperature))
} else {
self.Data[sensor.SensorKey] = int(sensor.Temperature)
}
2018-11-30 09:37:41 +08:00
}
2018-05-16 04:48:26 +08:00
}
}