tConfigure temp from args - spoon - dwm status utility (2f30 fork) | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit e3980ef0a7422351304ffe3b87a4fa8192a87c83 | |
parent 139166f7e6da95d81c6b61f08d71a19acb8f7e3a | |
Author: Christoph Polcin <[email protected]> | |
Date: Wed, 14 Mar 2018 09:06:43 +0100 | |
Configure temp from args | |
Signed-off-by: Christoph Polcin <[email protected]> | |
Diffstat: | |
M Makefile | 1 - | |
M config.def.h | 2 +- | |
M temp.c | 5 +++-- | |
3 files changed, 4 insertions(+), 4 deletions(-) | |
--- | |
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)) | |
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… | |
{ .fmt = "%s ", .read = battread, .arg = &(struc… | |
{ .fmt = "%s ", .read = wifiread, .arg = NULL }, | |
{ .fmt = "[%s] ", .read = xkblayoutread, .arg = NULL }, | |
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); |