From 507cb5a824d07f1edf73f270d485180645cb87fa Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Thu, 3 Jun 2021 10:22:25 +0200 Subject: also get ips --- dwmstatus/custom.diff | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'dwmstatus') diff --git a/dwmstatus/custom.diff b/dwmstatus/custom.diff index 14db8a7..d5080f3 100644 --- a/dwmstatus/custom.diff +++ b/dwmstatus/custom.diff @@ -66,6 +66,12 @@ index d2a4b03..4f09dde 100644 + char *co = smprintf("mpc -h core-a.lan | head -n 1 | tr -d '\n'"); + return getresult(co); +} ++ ++char * ++getips() { ++ char *co = smprintf("ip a | grep 'inet ' | grep -v 127.0.0.1 | tr -s ' ' | cut -f 3 -d ' ' | tr '\n' ' '"); ++ return getresult(co); ++} + int main(void) @@ -81,6 +87,7 @@ index d2a4b03..4f09dde 100644 + char *partition; + char *temp; + char *track; ++ char *ips; if (!(dpy = XOpenDisplay(NULL))) { fprintf(stderr, "dwmstatus: cannot open display.\n"); @@ -88,7 +95,7 @@ index d2a4b03..4f09dde 100644 } - for (;;sleep(60)) { -+ for (;;sleep(10)) { ++ for (;;sleep(1)) { avgs = loadavg(); - bat = getbattery("/sys/class/power_supply/BAT0"); - bat1 = getbattery("/sys/class/power_supply/BAT1"); @@ -106,8 +113,9 @@ index d2a4b03..4f09dde 100644 + tmbln = mktimes("%a %d %b %H:%M", tzberlin); + temp = gettemp(); + track = gettrack(); ++ ips = getips(); + -+ status = smprintf(" %s | %s | %s | %s | %s", ++ status = smprintf(" %s | %s | %s | %s | %s | %s", + track, avgs, temp, partition, tmbln); setstatus(status); -- cgit v1.2.3