summaryrefslogtreecommitdiff
path: root/dwmstatus-temperature.c
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2017-09-10 19:28:54 +0200
committerChristoph Lohmann <20h@r-36.net>2017-09-10 19:28:54 +0200
commita1751622782eb9d3d9bfae56b75b857d8cbd0c6c (patch)
tree903002f46f60ceb8afb7c26fc2ac409e8ab877aa /dwmstatus-temperature.c
Initial commit.
Diffstat (limited to 'dwmstatus-temperature.c')
-rw-r--r--dwmstatus-temperature.c15
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);
+}
+