1
0
mirror of https://github.com/alrayyes/slstatus synced 2023-11-14 15:56:27 +00:00

added ipv4_multiple

This commit is contained in:
Ryan Kes 2019-03-12 09:54:39 +01:00
parent 4aca176a37
commit b472dd3f74
3 changed files with 68 additions and 3 deletions

View File

@ -13,6 +13,7 @@ license=('custom:ISC')
_patches=(
"seperator-20180305-f4e35fa.diff"
"backlight-20180305-85a4a18.diff"
"ipv4-multiple-20190312-5f08c89.diff"
)
source=("git+https://git.suckless.org/${pkgname%-git}"
@ -20,9 +21,10 @@ source=("git+https://git.suckless.org/${pkgname%-git}"
"${_patches[@]}")
md5sums=('SKIP'
'f012506948aac85a43c35d7e09d7483e'
'b52b327f7fdf0432e798e79b410fc2ed'
'24ea93ef665decc0315248f62aa65f44'
'58404d0af1893f560926daf605a79919')
'58404d0af1893f560926daf605a79919'
'fc9b31ea31470b6816f1f92c6bc6fa9d')
pkgver() {
cd "${pkgname%-git}"

View File

@ -29,6 +29,7 @@ static const char unknown_str[] = "n/a";
* gid GID of current user NULL
* hostname hostname NULL
* ipv4 IPv4 address interface name (eth0)
* ipv4_multiple IPV4 address NULL
* ipv6 IPv6 address interface name (eth0)
* kernel_release `uname -r` NULL
* keyboard_indicators caps/num lock indicators format string (c?n?)
@ -65,7 +66,7 @@ static const struct arg args[] = {
{ wifi_essid, "\x06  %s", "wlp4s0" },
{ wifi_perc, " %s%% ", "wlp4s0" },
{ seperator, "\x07", NULL },
{ ipv4, "\x08  %s ", "wlp4s0" },
{ ipv4_multiple, "\x08  %s " },
{ seperator, "\x09", NULL },
{ netspeed_rx, "\x0A  %s", "wlp4s0" },
{ netspeed_tx, "  %s ", "wlp4s0" },

View File

@ -0,0 +1,62 @@
From 5f08c8987227a88449d0d2432b2e9dc6514540da Mon Sep 17 00:00:00 2001
From: Ryan Kes <alrayyes@gmail.com>
Date: Tue, 12 Mar 2019 09:50:35 +0100
Subject: [PATCH] added ipv4_multiple
---
components/ip.c | 13 +++++++++++++
config.def.h | 1 +
slstatus.h | 1 +
3 files changed, 15 insertions(+)
diff --git a/components/ip.c b/components/ip.c
index 70724eb..7a55d94 100644
--- a/components/ip.c
+++ b/components/ip.c
@@ -53,6 +53,19 @@ ipv4(const char *interface)
return ip(interface, AF_INET);
}
+const char *
+ipv4_multiple()
+{
+ char *output;
+
+ if(output = ipv4("wlp4s0"))
+ return output;
+ else if(output = ipv4("enp0s31f6"))
+ return output;
+
+ return NULL;
+}
+
const char *
ipv6(const char *interface)
{
diff --git a/config.def.h b/config.def.h
index d2f7045..665d25f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -30,6 +30,7 @@ static const char unknown_str[] = "n/a";
* gid GID of current user NULL
* hostname hostname NULL
* ipv4 IPv4 address interface name (eth0)
+ * ipv4_multiple IPv4 address NULL
* ipv6 IPv6 address interface name (eth0)
* kernel_release `uname -r` NULL
* keyboard_indicators caps/num lock indicators format string (c?n?)
diff --git a/slstatus.h b/slstatus.h
index a46f276..1f754d0 100644
--- a/slstatus.h
+++ b/slstatus.h
@@ -29,6 +29,7 @@ const char *hostname(void);
/* ip */
const char *ipv4(const char *interface);
+const char *ipv4_multiple(void);
const char *ipv6(const char *interface);
/* kernel_release */
--
2.21.0