aboutsummaryrefslogtreecommitdiff
path: root/lemonbar/bin/get_network_info.sh
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2020-08-21 17:54:40 -0400
committerTucker Evans <tuckerevans24@gmail.com>2020-08-21 17:54:40 -0400
commitbf7112109df945927f97555a208bf4c335141fb7 (patch)
tree1a8c293235956a3d41054256877c026d2452dbd8 /lemonbar/bin/get_network_info.sh
parent5c6bc56b76d440fa805dbbde45d5e3e25e2d9965 (diff)
Add lemonbar info
Diffstat (limited to 'lemonbar/bin/get_network_info.sh')
-rwxr-xr-xlemonbar/bin/get_network_info.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/lemonbar/bin/get_network_info.sh b/lemonbar/bin/get_network_info.sh
new file mode 100755
index 0000000..f85b0f6
--- /dev/null
+++ b/lemonbar/bin/get_network_info.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+
+for DEV in `ip -o addr | awk '{if($2 != "lo" && $3 == "inet"){print $2}}'`
+do
+ SSID=""
+ OUTPUT=""
+ ADDR=`ip addr show dev "$DEV" | grep -E "inet[^6]" \
+ | awk '{print $2}'`
+ MATCH=`expr "$DEV" : "^wlp"`
+ if test "$MATCH" -gt 0
+ then
+ SSID=`iw dev "$DEV" link | grep SSID | awk '{print $2}'`
+ SSID="$SSID: "
+ fi
+
+ if test -n "$OUTPUT"
+ then
+ OUTPUT="$OUTPUT | ($DEV) $SSID$ADDR"
+ else
+ OUTPUT="($DEV) $SSID$ADDR"
+ fi
+done
+
+echo "$OUTPUT"