tBlink battery icon when on critical level - spoon - dwm status utility (2f30 f… | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit aa42a4ea27a184dc5d3f6256dc8efc5956557a7d | |
parent dc742d20742b5b09431e66db6f726c86fdc95e47 | |
Author: lostd <[email protected]> | |
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(-) | |
--- | |
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) |