tBlink battery icon when on critical level - spoon - dwm status utility (2f30 fork) (HTM) git clone git://src.adamsgaard.dk/spoon (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit aa42a4ea27a184dc5d3f6256dc8efc5956557a7d (DIR) parent dc742d20742b5b09431e66db6f726c86fdc95e47 (HTM) Author: lostd <lostd@2f30.org> Date: Thu, 6 Apr 2017 11:04:42 +0300 Blink battery icon when on critical level Diffstat: M batt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- (DIR) diff --git a/batt.c b/batt.c t@@ -1,14 +1,22 @@ #include <err.h> #include <stdio.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, "[!!!!]="); + snprintf(buf, len, "%s", crit[frame++ % LEN(crit)]); else if (life >= 80) snprintf(buf, len, "[////]="); else if (life >= 60)