dwmstatus

a simple dwm statusbar updater written in C.
git clone git://git.suckless.org/dwmstatus
Log | Files | Refs | LICENSE

commit 98cefea98cbcdecb498e00479112800c6b6fc7b7
parent 76e1a233e088b3cffb00fde44fcc7c37a0eac038
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 19 Jul 2015 20:40:02 +0200

Revert "added battery capacity info"

This reverts commit 76e1a233e088b3cffb00fde44fcc7c37a0eac038.

There is already a battery function on the wiki site. There is no need for
this dependency in the default repository. Please ask me, the maintainer,
before adding such a change.

Diffstat:
dwmstatus.c | 35++++++-----------------------------
1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/dwmstatus.c b/dwmstatus.c @@ -12,9 +12,7 @@ #include <X11/Xlib.h> -char *sysbat = "/sys/class/power_supply/BAT0/capacity"; -char *tzsf = "US/Pacific"; -char *tztokyo= "Japan"; +char *tzargentina = "America/Buenos_Aires"; char *tzutc = "UTC"; char *tzberlin = "Europe/Berlin"; @@ -82,22 +80,6 @@ setstatus(char *str) } char * -batcap(void) -{ - char cap[16], *r = NULL; - FILE *f = fopen(sysbat, "r"); - - memset(cap, 1, sizeof cap); - if (f) { - r = fgets(cap, sizeof cap, f); - if (r == cap) - cap[strlen(cap)-1] = '\0'; - fclose(f); - } - return smprintf("%s%%", r != NULL ? r : "?"); -} - -char * loadavg(void) { double avgs[3]; @@ -113,11 +95,9 @@ loadavg(void) int main(void) { - char *cap; char *status; char *avgs; - char *tmsf; - char *tmtokyo; + char *tmar; char *tmutc; char *tmbln; @@ -127,19 +107,16 @@ main(void) } for (;;sleep(90)) { - cap = batcap(); avgs = loadavg(); - tmsf = mktimes("%H:%M", tzsf); - tmtokyo = mktimes("%H:%M", tztokyo); + tmar = mktimes("%H:%M", tzargentina); tmutc = mktimes("%H:%M", tzutc); tmbln = mktimes("KW %W %a %d %b %H:%M %Z %Y", tzberlin); - status = smprintf("B:%s L:%s SF:%s JP:%s U:%s %s", - cap, avgs, tmsf, tmtokyo, tmutc, tmbln); + status = smprintf("L:%s A:%s U:%s %s", + avgs, tmar, tmutc, tmbln); setstatus(status); free(avgs); - free(tmsf); - free(tmtokyo); + free(tmar); free(tmutc); free(tmbln); free(status);