spoon

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

commit 139166f7e6da95d81c6b61f08d71a19acb8f7e3a
parent 73d2f4ed504a341a3d2fbefb14d2048ff1987edf
Author: Christoph Polcin <labs@polcin.de>
Date:   Wed, 14 Mar 2018 09:06:42 +0100

Custom temp format

Signed-off-by: Christoph Polcin <labs@polcin.de>

Diffstat:
config.def.h | 2+-
temp.c | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

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 = NULL }, { .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 @@ -22,7 +22,7 @@ tempread(void *arg, char *buf, size_t len) if (sysctl(mib, 5, &temp, &sz, NULL, 0) == -1) return -1; /* temp.value is in kelvin so convert to celsius for display */ - snprintf(buf, len, "%ddegC", (temp.value - 273150000) / 1000000); + snprintf(buf, len, "%d", (temp.value - 273150000) / 1000000); return 0; } #elif __linux__ @@ -39,7 +39,7 @@ tempread(void *arg, char *buf, size_t len) } fscanf(fp, "%d", &temp); fclose(fp); - snprintf(buf, len, "%ddegC", temp / 1000); + snprintf(buf, len, "%d", temp / 1000); return 0; } #endif