flakes/navi/laniakea/eww/get_wifi.sh
2026-04-10 18:50:25 +03:00

14 lines
485 B
Bash
Executable file

#!/bin/sh
iface=$(ip link | awk '/state UP/ && !/lo/ {print $2}' | tr -d ':' | grep -v eth | head -1)
ssid=$(iwgetid "$iface" -r 2>/dev/null)
strength=$(awk "/$iface/ {print int(\$3 * 100 / 70)}" /proc/net/wireless 2>/dev/null)
if [ -z "$ssid" ]; then
echo "󰤭 disconnected"
else
if [ "$strength" -ge 75 ]; then icon="󰤨"
elif [ "$strength" -ge 50 ]; then icon="󰤥"
elif [ "$strength" -ge 25 ]; then icon="󰤢"
else icon="󰤟"
fi
echo "$icon $ssid $strength%"
fi