[hackers] [dwmstatus] Revert "added battery capacity info" || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Sun, 19 Jul 2015 20:41:00 +0200 (CEST)

commit 98cefea98cbcdecb498e00479112800c6b6fc7b7
Author: Christoph Lohmann <20h_AT_r-36.net>
AuthorDate: Sun Jul 19 20:40:02 2015 +0200
Commit: Christoph Lohmann <20h_AT_r-36.net>
CommitDate: Sun Jul 19 20:40:02 2015 +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.

diff --git a/dwmstatus.c b/dwmstatus.c
index 3d03dd8..236bca6 100644
--- a/dwmstatus.c
+++ b/dwmstatus.c
_AT_@ -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";
 
_AT_@ -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];
_AT_@ -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;
 
_AT_@ -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);
Received on Sun Jul 19 2015 - 20:41:00 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 19 2015 - 20:48:11 CEST