1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
diff --git a/dwmstatus.c b/dwmstatus.c
index d2a4b03..cbb5f6c 100644
--- a/dwmstatus.c
+++ b/dwmstatus.c
@@ -17,8 +17,6 @@
#include <X11/Xlib.h>
-char *tzargentina = "America/Buenos_Aires";
-char *tzutc = "UTC";
char *tzberlin = "Europe/Berlin";
static Display *dpy;
@@ -89,7 +87,7 @@ loadavg(void)
if (getloadavg(avgs, 3) < 0)
return smprintf("");
- return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
+ return smprintf("%.2f", avgs[1]);
}
char *
@@ -155,7 +153,7 @@ getbattery(char *base)
} else if(!strncmp(co, "Charging", 8)) {
status = '+';
} else {
- status = '?';
+ status = '\0';
}
if (remcap < 0 || descap < 0)
@@ -181,11 +179,7 @@ main(void)
char *status;
char *avgs;
char *bat;
- char *bat1;
- char *tmar;
- char *tmutc;
char *tmbln;
- char *t0, *t1, *t2;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
@@ -195,27 +189,14 @@ main(void)
for (;;sleep(60)) {
avgs = loadavg();
bat = getbattery("/sys/class/power_supply/BAT0");
- bat1 = getbattery("/sys/class/power_supply/BAT1");
- tmar = mktimes("%H:%M", tzargentina);
- tmutc = mktimes("%H:%M", tzutc);
- tmbln = mktimes("KW %W %a %d %b %H:%M %Z %Y", tzberlin);
- t0 = gettemperature("/sys/devices/virtual/hwmon/hwmon0", "temp1_input");
- t1 = gettemperature("/sys/devices/virtual/hwmon/hwmon2", "temp1_input");
- t2 = gettemperature("/sys/devices/virtual/hwmon/hwmon4", "temp1_input");
-
- status = smprintf("T:%s|%s|%s L:%s B:%s|%s A:%s U:%s %s",
- t0, t1, t2, avgs, bat, bat1, tmar, tmutc,
- tmbln);
+ tmbln = mktimes("%a %d %b %H:%M", tzberlin);
+
+ status = smprintf("%s %s %s",
+ avgs, bat, tmbln);
setstatus(status);
- free(t0);
- free(t1);
- free(t2);
free(avgs);
free(bat);
- free(bat1);
- free(tmar);
- free(tmutc);
free(tmbln);
free(status);
}
|