xbattmon

simple battery monitor for X
git clone git://git.2f30.org/xbattmon
Log | Files | Refs | README | LICENSE

commit d968c37aee05dcdb4a2f51d43205716975c2d68c
parent a2958cc8b71324633b7faccbc4dab5b6b891f0d0
Author: sin <sin@2f30.org>
Date:   Thu, 30 Oct 2014 23:01:30 +0000

Allow maximum battery capacity to be tweaked

Diffstat:
Mxbattmon.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xbattmon.c b/xbattmon.c @@ -57,11 +57,13 @@ int barx; int bary; unsigned int barwidth; unsigned int barheight; -unsigned int thickness = 4; /* 4 pixels by default */ -time_t pollinterval = 5; /* poll battery state every 5 seconds */ int state; /* BATT_CHARGING or BATT_DRAINING */ int howmuch; /* 0 if completely discharged or 100 if completely charged */ + +unsigned int thickness = 4; /* 4 pixels by default */ +time_t pollinterval = 5; /* poll battery state every 5 seconds */ int bottom = 1; /* set to 0 if you want the bar to be at the top */ +int max = 100; /* maximum battery capacity */ void setup(void) @@ -119,7 +121,7 @@ redraw(void) { int pos; - pos = barwidth * howmuch / 100; + pos = barwidth * howmuch / max; switch (state) { case BATT_CHARGING: XSetForeground(dpy, gcbar, colmap[COLOR_BATT_CHARGED].pixel);