cfg/.config/i3blocks/wifi
Knut Ahlers 20d45a6232
Better symbol
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-12-11 17:17:46 +01:00

20 lines
513 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
interface=$(ip a | grep 'wlp.*:' | sed -E 's/^[0-9]*: ([^:]+):.*/\1/')
# We found no wlp* interface: Get out here
[ -z "${interface}" ] && exit
ip=$(ip a show ${interface} | awk '/inet .* scope global/{ print $2 }' | cut -d '/' -f1)
# We found no ip: Get out here
[ -z "${ip}" ] && exit
network=$(iwgetid -r)
# We found no network: Get out here
[ -z "${network}" ] && exit
printf "\uf9a1 <span color=\"#8FAAFC\">%s</span> <span color=\"#50fa7b\">(%s)</span>" ${network} ${ip}