spoon

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

commit 306dc969538f7ccee7e607f6781d647606076883
parent db31075bc39b4ff751d9ea719a59204eb3b9dd7b
Author: lostd <lostd@2f30.org>
Date:   Tue Oct 11 16:53:43 +0200

Change capacity ranges and add a critical icon

There are five ASCII icons: empty and one, two, three or four bars.
Make the ranges equal so they are displayed for about the same amount
of time.  Also add a critical icon for when discharging and below 5%.

Diffstat:
batt.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/batt.c b/batt.c @@ -7,13 +7,15 @@ battprint(char *buf, size_t len, int acon , int life) char c; c = acon ? '>' : '<'; - if (life == 100) + if (!acon && life <= 5) + snprintf(buf, len, "[!!!!]="); + else if (life >= 80) snprintf(buf, len, "[////]="); - else if (life >= 75) + else if (life >= 60) snprintf(buf, len, "[///%c]=", c); - else if (life >= 50) + else if (life >= 40) snprintf(buf, len, "[//%c%c]=", c, c); - else if (life >= 25) + 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);