added netspeed-multiple patch

This commit is contained in:
Ryan Kes 2019-03-12 10:16:44 +01:00
parent ab12b0cdb9
commit c66124061f
3 changed files with 68 additions and 5 deletions

View file

@ -14,6 +14,7 @@ _patches=(
"seperator-20190305-f4e35fa.diff" "seperator-20190305-f4e35fa.diff"
"backlight-20190305-85a4a18.diff" "backlight-20190305-85a4a18.diff"
"ipv4-multiple-20190312-5f08c89.diff" "ipv4-multiple-20190312-5f08c89.diff"
"netspeed-multiple-20190312-2ac86e1.diff"
) )
source=("git+https://git.suckless.org/${pkgname%-git}" source=("git+https://git.suckless.org/${pkgname%-git}"
@ -21,10 +22,11 @@ source=("git+https://git.suckless.org/${pkgname%-git}"
"${_patches[@]}") "${_patches[@]}")
md5sums=('SKIP' md5sums=('SKIP'
'b52b327f7fdf0432e798e79b410fc2ed' 'ed201d76de309678c72007413f4c7005'
'24ea93ef665decc0315248f62aa65f44' '24ea93ef665decc0315248f62aa65f44'
'58404d0af1893f560926daf605a79919' '58404d0af1893f560926daf605a79919'
'fc9b31ea31470b6816f1f92c6bc6fa9d') 'fc9b31ea31470b6816f1f92c6bc6fa9d'
'30f0a42ffc0e4f1e102ad2e3d1afe988')
pkgver() { pkgver() {
cd "${pkgname%-git}" cd "${pkgname%-git}"

View file

@ -39,6 +39,8 @@ static const char unknown_str[] = "n/a";
* load_avg load average NULL * load_avg load average NULL
* netspeed_rx receive network speed interface name (wlan0) * netspeed_rx receive network speed interface name (wlan0)
* netspeed_tx transfer network speed interface name (wlan0) * netspeed_tx transfer network speed interface name (wlan0)
* netspeed_rx_multiple receive network speed NULL
* netspeed_tx_multiple transfer network speed NULL
* num_files number of files in a directory path * num_files number of files in a directory path
* (/home/foo/Inbox/cur) * (/home/foo/Inbox/cur)
* ram_free free memory in GB NULL * ram_free free memory in GB NULL
@ -66,10 +68,10 @@ static const struct arg args[] = {
{ wifi_essid, "\x06  %s", "wlp4s0" }, { wifi_essid, "\x06  %s", "wlp4s0" },
{ wifi_perc, " %s%% ", "wlp4s0" }, { wifi_perc, " %s%% ", "wlp4s0" },
{ seperator, "\x07", NULL }, { seperator, "\x07", NULL },
{ ipv4_multiple, "\x08  %s " }, { ipv4_multiple, "\x08  %s ", NULL },
{ seperator, "\x09", NULL }, { seperator, "\x09", NULL },
{ netspeed_rx, "\x0A  %s", "wlp4s0" }, { netspeed_rx_multiple, "\x0A  %s", NULL },
{ netspeed_tx, "  %s ", "wlp4s0" }, { netspeed_tx_multiple, "  %s ", NULL },
{ seperator, "\x0B", NULL }, { seperator, "\x0B", NULL },
{ battery_perc, "\x0C  %s%%", "BAT0" }, { battery_perc, "\x0C  %s%%", "BAT0" },
{ battery_remaining, " %s ", "BAT0" }, { battery_remaining, " %s ", "BAT0" },

View file

@ -0,0 +1,59 @@
From 2ac86e1582f9eb97d71d11e34104f40e3b95df72 Mon Sep 17 00:00:00 2001
From: Ryan Kes <alrayyes@gmail.com>
Date: Tue, 12 Mar 2019 10:14:10 +0100
Subject: [PATCH] added netspeed_tx_multiple & netspeed_rx_multiple
---
components/netspeeds.c | 22 ++++++++++++++++++++++
slstatus.h | 2 ++
2 files changed, 24 insertions(+)
diff --git a/components/netspeeds.c b/components/netspeeds.c
index 0029177..2ca19c2 100644
--- a/components/netspeeds.c
+++ b/components/netspeeds.c
@@ -58,6 +58,28 @@
return fmt_human((txbytes - oldtxbytes) * 1000 / interval,
1024);
}
+
+ const char *
+ netspeed_tx_multiple()
+ {
+ if (ipv4("wlp4s0"))
+ return netspeed_tx("wlp4s0");
+ else if (ipv4("enp0s31f6"))
+ return netspeed_tx("enp0s31f6");
+
+ return NULL;
+ }
+
+ const char *
+ netspeed_rx_multiple()
+ {
+ if (ipv4("wlp4s0"))
+ return netspeed_rx("wlp4s0");
+ else if (ipv4("enp0s31f6"))
+ return netspeed_rx("enp0s31f6");
+
+ return NULL;
+ }
#elif defined(__OpenBSD__) | defined(__FreeBSD__)
#include <string.h>
#include <ifaddrs.h>
diff --git a/slstatus.h b/slstatus.h
index 1f754d0..aaaec9e 100644
--- a/slstatus.h
+++ b/slstatus.h
@@ -47,6 +47,8 @@ const char *load_avg(void);
/* netspeeds */
const char *netspeed_rx(const char *interface);
const char *netspeed_tx(const char *interface);
+const char *netspeed_rx_multiple();
+const char *netspeed_tx_multiple();
/* num_files */
const char *num_files(const char *path);
--
2.21.0