spoon

set dwm status
git clone git://git.2f30.org/spoon
Log | Files | Refs | LICENSE

commit e3980ef0a7422351304ffe3b87a4fa8192a87c83
parent 139166f7e6da95d81c6b61f08d71a19acb8f7e3a
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:
MMakefile | 1-
Mconfig.def.h | 2+-
Mtemp.c | 5+++--
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -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 @@ -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 }, diff --git a/temp.c b/temp.c @@ -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);