nixos/home/hyprland/ironbar/reference/scripts/net
Evie Litherland-Smith be1d5fa798 Switch to minimal ironbar implementation
Save reference for later
Enable upower daemon and add simple bar with the essentials for now,
TODO more later
2023-10-11 08:28:27 +01:00

29 lines
620 B
Bash
Executable file

#!/usr/bin/env bash
while true; do
status=$(nmcli g | tail -n 1 | awk '{print $1}')
signal=$(nmcli dev wifi | rg "\*" | awk '{ print $9 }')
essid=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)
icons=("󰤯" "󰤟" "󰤢" "󰤥" "󰤨")
if [ "$status" = "disconnected" ] ; then
icon=""
text=""
color="#988ba2"
else
level=$(awk -v n="$signal" 'BEGIN{print int(n/20)}')
if [ "$level" -gt 4 ]; then
level=4
fi
icon=${icons[$level]}
color="#cba6f7"
fi
echo '{ "essid": "'"$essid"'", "icon": "'"$icon"'", "color": "'"$color"'" }'
sleep 3
done