infrastructure/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh

17 lines
361 B
Bash
Raw Normal View History

2022-08-24 18:17:29 +02:00
#!/bin/sh
if nmcli g | rg -q "\bconnected\b"; then
icon="󰤨"
ssid=$(nmcli -t -f name connection show --active)
if echo $ssid | rg -q "Wired"; then
status="Connected via cable"
else
status="Connected to ${ssid}"
fi
else
icon="󰤭"
status="offline"
fi
printf "{\"icon\": \"${icon}\", \"status\": \"${status}\"}"