summaryrefslogtreecommitdiff
path: root/i3/.config/i3blocks
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2021-09-03 18:22:36 +0200
committerUrbain Vaes <urbain@vaes.uk>2021-09-03 18:22:36 +0200
commit29cbb903a5c2bf074b26e3c87c4cbb69793b3e19 (patch)
tree30f892c515e32fc5338ea6383a62248955d6f1a5 /i3/.config/i3blocks
parentfce46ed7e852dfc60466c50f348c0c2c7caba7fc (diff)
Fix i3 bugs
Diffstat (limited to 'i3/.config/i3blocks')
-rwxr-xr-xi3/.config/i3blocks/bin/wifi9
1 files changed, 5 insertions, 4 deletions
diff --git a/i3/.config/i3blocks/bin/wifi b/i3/.config/i3blocks/bin/wifi
index bc24672..b545c24 100755
--- a/i3/.config/i3blocks/bin/wifi
+++ b/i3/.config/i3blocks/bin/wifi
@@ -1,15 +1,16 @@
#!/usr/bin/env bash
-quality=$(iwconfig wlp2s0 2>/dev/null | grep -oP 'Link Quality=\K[0-9]*/[0-9]*' | awk -F'/' '{print int(100*$1/$2)}')
-ssid=$(iwconfig wlp2s0 2>/dev/null | grep -oP '(?<=ESSID:").*(?=")')
-wifi_address=$(ip addr show wlp2s0 2>/dev/null | grep -oP -m1 "(?<=inet ).*(?=/)")
+wireless=$(ip link | grep -oP -m1 "(wlp[^:]*)")
+quality=$(iwconfig $wireless 2>/dev/null | grep -oP 'Link Quality=\K[0-9]*/[0-9]*' | awk -F'/' '{print int(100*$1/$2)}')
+ssid=$(iwconfig $wireless 2>/dev/null | grep -oP '(?<=ESSID:")[^\"]*')
+wifi_address=$(ip addr show $wireless 2>/dev/null | grep -oP -m1 "(?<=inet ).*(?=/)")
eth_address=$(ip addr show eno1 2>/dev/null | grep -oP -m1 "(?<=inet ).*(?=/)")
if [[ -n $eth_address ]]; then
full_text="eno1: $eth_address"
ip_addr="$eth_address"
elif [[ -n $wifi_address ]]; then
- full_text="wlp2s0: (${quality}% at ${ssid}) ${wifi_address}"
+ full_text="${wifi_address} (${quality}% at ${ssid})"
ip_addr="$wifi_address"
else
echo "No connection"