spoon: add OpenBSD output customization patch

This commit is contained in:
Lucas 2020-01-26 14:59:40 +00:00
parent 3ca9d661dc
commit 776714b53c

View File

@ -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;