spoon

set dwm status
git clone git://git.2f30.org/spoon
Log | Files | Refs | LICENSE

commit aa42a4ea27a184dc5d3f6256dc8efc5956557a7d
parent dc742d20742b5b09431e66db6f726c86fdc95e47
Author: lostd <lostd@2f30.org>
Date:   Thu,  6 Apr 2017 11:04:42 +0300

Blink battery icon when on critical level

Diffstat:
Mbatt.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/batt.c b/batt.c @@ -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)