xbattmon

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

commit affca0347b5dfa97cd1f5390bc694f7d683dc4c1
parent 808065e6f91db1e9c2f05e1cbc6cd096c99347eb
Author: sin <sin@2f30.org>
Date:   Sun,  2 Nov 2014 14:49:57 +0000

Rename howmuch to batcap

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

diff --git a/xbattmon.c b/xbattmon.c @@ -40,7 +40,7 @@ int bary; unsigned int barwidth; unsigned int barheight; int state; /* AC_ON or AC_OFF */ -int howmuch; /* 0 if completely discharged or `maxcap' if completely charged */ +int batcap; /* 0 if completely discharged or `maxcap' if completely charged */ #include "config.h" @@ -108,7 +108,7 @@ redraw(void) { int pos; - pos = barwidth * howmuch / maxcap; + pos = barwidth * batcap / maxcap; switch (state) { case AC_ON: XSetForeground(dpy, gcbar, cmap[COLOR_BAT_CHARGED]); @@ -143,9 +143,9 @@ pollbat(void) err(1, "APM_IOC_GETPOWER %s", PATH_APM); close(fd); - howmuch = info.battery_life; - if (howmuch > maxcap) - howmuch = maxcap; + batcap = info.battery_life; + if (batcap > maxcap) + batcap = maxcap; if (info.ac_state == APM_AC_UNKNOWN) warnx("unknown AC state"); @@ -163,11 +163,11 @@ pollbat(void) fp = fopen(PATH_BAT0_CAP, "r"); if (fp == NULL) err(1, "fopen %s", PATH_BAT0_CAP); - fscanf(fp, "%d", &howmuch); + fscanf(fp, "%d", &batcap); fclose(fp); - if (howmuch > maxcap) - howmuch = maxcap; + if (batcap > maxcap) + batcap = maxcap; #define PATH_AC_ONLINE "/sys/class/power_supply/AC/online" fp = fopen(PATH_AC_ONLINE, "r");