tCustom temp format - spoon - dwm status utility (2f30 fork) (HTM) git clone git://src.adamsgaard.dk/spoon (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit 139166f7e6da95d81c6b61f08d71a19acb8f7e3a (DIR) parent 73d2f4ed504a341a3d2fbefb14d2048ff1987edf (HTM) 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: M config.def.h | 2 +- M temp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- (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 = 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 }, (DIR) diff --git a/temp.c b/temp.c t@@ -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__ t@@ -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