From c66124061fc8b2ffc5ca62282f6f0227a0cdb1a5 Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Tue, 12 Mar 2019 10:16:44 +0100 Subject: [PATCH] added netspeed-multiple patch --- PKGBUILD | 6 ++- config.h | 8 ++-- netspeed-multiple-20190312-2ac86e1.diff | 59 +++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 netspeed-multiple-20190312-2ac86e1.diff diff --git a/PKGBUILD b/PKGBUILD index 19fbb80..794be72 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -14,6 +14,7 @@ _patches=( "seperator-20190305-f4e35fa.diff" "backlight-20190305-85a4a18.diff" "ipv4-multiple-20190312-5f08c89.diff" + "netspeed-multiple-20190312-2ac86e1.diff" ) source=("git+https://git.suckless.org/${pkgname%-git}" @@ -21,10 +22,11 @@ source=("git+https://git.suckless.org/${pkgname%-git}" "${_patches[@]}") md5sums=('SKIP' - 'b52b327f7fdf0432e798e79b410fc2ed' + 'ed201d76de309678c72007413f4c7005' '24ea93ef665decc0315248f62aa65f44' '58404d0af1893f560926daf605a79919' - 'fc9b31ea31470b6816f1f92c6bc6fa9d') + 'fc9b31ea31470b6816f1f92c6bc6fa9d' + '30f0a42ffc0e4f1e102ad2e3d1afe988') pkgver() { cd "${pkgname%-git}" diff --git a/config.h b/config.h index 280f176..a7ed249 100644 --- a/config.h +++ b/config.h @@ -39,6 +39,8 @@ static const char unknown_str[] = "n/a"; * load_avg load average NULL * netspeed_rx receive 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 * (/home/foo/Inbox/cur) * ram_free free memory in GB NULL @@ -66,10 +68,10 @@ static const struct arg args[] = { { wifi_essid, "\x06  %s", "wlp4s0" }, { wifi_perc, " %s%% ", "wlp4s0" }, { seperator, "\x07", NULL }, - { ipv4_multiple, "\x08  %s " }, + { ipv4_multiple, "\x08  %s ", NULL }, { seperator, "\x09", NULL }, - { netspeed_rx, "\x0A  %s", "wlp4s0" }, - { netspeed_tx, "  %s ", "wlp4s0" }, + { netspeed_rx_multiple, "\x0A  %s", NULL }, + { netspeed_tx_multiple, "  %s ", NULL }, { seperator, "\x0B", NULL }, { battery_perc, "\x0C  %s%%", "BAT0" }, { battery_remaining, " %s ", "BAT0" }, diff --git a/netspeed-multiple-20190312-2ac86e1.diff b/netspeed-multiple-20190312-2ac86e1.diff new file mode 100644 index 0000000..095cc3e --- /dev/null +++ b/netspeed-multiple-20190312-2ac86e1.diff @@ -0,0 +1,59 @@ +From 2ac86e1582f9eb97d71d11e34104f40e3b95df72 Mon Sep 17 00:00:00 2001 +From: Ryan Kes +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 + #include +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 +