tConfigure temp from args - spoon - dwm status utility (2f30 fork)
(HTM) git clone git://src.adamsgaard.dk/spoon
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit e3980ef0a7422351304ffe3b87a4fa8192a87c83
(DIR) parent 139166f7e6da95d81c6b61f08d71a19acb8f7e3a
(HTM) Author: Christoph Polcin <labs@polcin.de>
Date: Wed, 14 Mar 2018 09:06:43 +0100
Configure temp from args
Signed-off-by: Christoph Polcin <labs@polcin.de>
Diffstat:
M Makefile | 1 -
M config.def.h | 2 +-
M temp.c | 5 +++--
3 files changed, 4 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
t@@ -13,7 +13,6 @@ CPPFLAGS_OpenBSD = -I/usr/X11R6/include -I/usr/local/include
LDFLAGS_OpenBSD = -L/usr/X11R6/lib -L/usr/local/lib
CPPFLAGS_Linux =\
-I/usr/local/include\
- -DPATH_TEMP=\"/sys/class/hwmon/hwmon1/temp1_input\"\
-DPATH_CPU_FREQ=\"/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq\"
CPPFLAGS = $(CPPFLAGS_$(UNAME))
LDFLAGS = $(LDFLAGS_$(UNAME))
(DIR) diff --git a/config.def.h b/config.def.h
t@@ -7,7 +7,7 @@ struct ent ents[] = {
{ .fmt = "[%s] ", .read = mixread, .arg = NULL },
{ .fmt = "[%s] ", .read = loadread, .arg = NULL },
{ .fmt = "[%s] ", .read = cpuread, .arg = NULL },
- { .fmt = "[%s°] ", .read = tempread, .arg = NULL },
+ { .fmt = "[%s°] ", .read = tempread, .arg = "/sys/class/hwmon/hwmon1/temp1_input" },
{ .fmt = "%s ", .read = battread, .arg = &(struct battarg){ .cap = "/sys/class/power_supply/BAT0/capacity", .ac = "/sys/class/power_supply/AC/online" } },
{ .fmt = "%s ", .read = wifiread, .arg = NULL },
{ .fmt = "[%s] ", .read = xkblayoutread, .arg = NULL },
(DIR) diff --git a/temp.c b/temp.c
t@@ -29,12 +29,13 @@ tempread(void *arg, char *buf, size_t len)
int
tempread(void *arg, char *buf, size_t len)
{
+ char *path = arg;
FILE *fp;
int temp;
- fp = fopen(PATH_TEMP, "r");
+ fp = fopen(path, "r");
if (fp == NULL) {
- warn("fopen %s", PATH_TEMP);
+ warn("fopen %s", path);
return -1;
}
fscanf(fp, "%d", &temp);