From 776714b53c1ca7f2ceb59f1807e21896ab635e9d Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 26 Jan 2020 14:59:40 +0000 Subject: [PATCH] spoon: add OpenBSD output customization patch --- spoon/customization.patch-OpenBSD | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 spoon/customization.patch-OpenBSD diff --git a/spoon/customization.patch-OpenBSD b/spoon/customization.patch-OpenBSD new file mode 100644 index 0000000..fdb2ab4 --- /dev/null +++ b/spoon/customization.patch-OpenBSD @@ -0,0 +1,65 @@ +diff --git a/Makefile b/Makefile +index c8452bc..7328b1f 100644 +--- a/Makefile ++++ b/Makefile +@@ -31,8 +31,8 @@ LDLIBS += $(LDLIBS_$(UNAME)_mix) + OBJ += xkblayout.o + LDLIBS += -lxkbfile + +-OBJ += mpd.o +-LDLIBS += -lmpdclient ++#OBJ += mpd.o ++#LDLIBS += -lmpdclient + + all: $(BIN) + +diff --git a/batt.c b/batt.c +index 3d72888..1340db2 100644 +--- a/batt.c ++++ b/batt.c +@@ -4,30 +4,14 @@ + #include "types.h" + #include "util.h" + +-char *crit[] = { +- "[!!!!]=", +- " ", +-}; +- + void + battprint(char *buf, size_t len, int acon, int life) + { + char c; + static int frame = 0; + +- c = acon ? '>' : '<'; +- if (!acon && life <= 5) +- snprintf(buf, len, "%s", crit[frame++ % LEN(crit)]); +- else if (life >= 80) +- snprintf(buf, len, "[////]="); +- else if (life >= 60) +- snprintf(buf, len, "[///%c]=", c); +- else if (life >= 40) +- snprintf(buf, len, "[//%c%c]=", c, c); +- else if (life >= 20) +- snprintf(buf, len, "[/%c%c%c]=", c, c, c); +- else +- snprintf(buf, len, "[%c%c%c%c]=", c, c, c, c); ++ c = acon ? '^' : 'v'; ++ snprintf(buf, len, "B%c%3d%%", (frame ^= 1) ? c : ' ', life); + } + + #ifdef __OpenBSD__ +diff --git a/netspeed.c b/netspeed.c +index 557e369..c154558 100644 +--- a/netspeed.c ++++ b/netspeed.c +@@ -32,7 +32,7 @@ updatenetspeed(char *buf, size_t len, uint64_t rxbytes, uint64_t txbytes) + tx = (txbytes - oldtxbytes) / delay; + irx = humansz(rx); + itx = humansz(tx); +- snprintf(buf, len, "D:%6.1f%s/s U:%6.1f%s/s", rx ++ snprintf(buf, len, "v%6.1f%s/s ^%6.1f%s/s", rx + / (double)(1 << (10 * irx)), humansztbl[irx], tx + / (double)(1 << (10 * itx)), humansztbl[itx]); + oldrxbytes = rxbytes;