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