summaryrefslogtreecommitdiff
path: root/i3/.config/i3blocks/bin/wifi
blob: fd9a9c5f2bce63d50017538c98b3450f9a05abdd (plain)
1
2
3
4
5
6
7
#!/usr/bin/env bash

quality=$(iwconfig wlp2s0 | grep -oP 'Link Quality=\K[0-9]*/[0-9]*' | awk -F'/' '{print int(100*$1/$2)}')
ssid=$(iwconfig wlp2s0 | grep -oP '(?<=ESSID:").*(?=")')
address=$(ip addr show wlp2s0 | grep -oP -m1 "(?<=inet ).*(?=/)")

echo "(${quality}% at ${ssid}) ${address}"