summaryrefslogtreecommitdiff
path: root/dwmstatus
diff options
context:
space:
mode:
Diffstat (limited to 'dwmstatus')
-rw-r--r--dwmstatus/custom.diff40
1 files changed, 34 insertions, 6 deletions
diff --git a/dwmstatus/custom.diff b/dwmstatus/custom.diff
index 83faaba..b2c8798 100644
--- a/dwmstatus/custom.diff
+++ b/dwmstatus/custom.diff
@@ -1,5 +1,5 @@
diff --git a/dwmstatus.c b/dwmstatus.c
-index d2a4b03..cbb5f6c 100644
+index d2a4b03..5ab33db 100644
--- a/dwmstatus.c
+++ b/dwmstatus.c
@@ -17,8 +17,6 @@
@@ -29,7 +29,30 @@ index d2a4b03..cbb5f6c 100644
}
if (remcap < 0 || descap < 0)
-@@ -181,11 +179,7 @@ main(void)
+@@ -175,47 +173,49 @@ gettemperature(char *base, char *sensor)
+ return smprintf("%02.0f°C", atof(co) / 1000);
+ }
+
++char *
++getpartition(char *partition) {
++ char *co = smprintf("df -h | grep %s | cut -d ' ' -f 12 | tr -cd '[:print:]'", partition);
++ FILE *fd = popen(co, "r");
++ if (fd == NULL)
++ return smprintf("invalid");
++
++ char ret[8];
++ if (fgets(ret, 8, fd) == NULL)
++ return smprintf("invalid");
++
++ if (pclose(fd) == -1)
++ return smprintf("invalid");
++
++ return smprintf("%s", ret);
++}
++
+ int
+ main(void)
+ {
char *status;
char *avgs;
char *bat;
@@ -38,12 +61,17 @@ index d2a4b03..cbb5f6c 100644
- char *tmutc;
char *tmbln;
- char *t0, *t1, *t2;
++ char *partition;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
-@@ -195,27 +189,14 @@ main(void)
- for (;;sleep(60)) {
+ return 1;
+ }
+
+- for (;;sleep(60)) {
++ for (;;sleep(10)) {
avgs = loadavg();
++ partition = getpartition("sda1");
bat = getbattery("/sys/class/power_supply/BAT0");
- bat1 = getbattery("/sys/class/power_supply/BAT1");
- tmar = mktimes("%H:%M", tzargentina);
@@ -58,8 +86,8 @@ index d2a4b03..cbb5f6c 100644
- tmbln);
+ tmbln = mktimes("%a %d %b %H:%M", tzberlin);
+
-+ status = smprintf("%s %s %s",
-+ avgs, bat, tmbln);
++ status = smprintf("%s | %s | %s | %s",
++ avgs, partition, bat, tmbln);
setstatus(status);
- free(t0);