diff options
Diffstat (limited to 'dwmstatus-temperature.c')
-rw-r--r-- | dwmstatus-temperature.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dwmstatus-temperature.c b/dwmstatus-temperature.c new file mode 100644 index 0000000..13f27f6 --- /dev/null +++ b/dwmstatus-temperature.c @@ -0,0 +1,15 @@ +/* + * gettemperature("/sys/class/hwmon/hwmon0/device", "temp1_input"); + */ + +char * +gettemperature(char *base, char *sensor) +{ + char *co; + + co = readfile(base, sensor); + if (co == NULL) + return smprintf(""); + return smprintf("%02.0f°C", atof(co) / 1000); +} + |