nixos/home/hyprland/ironbar/reference/scripts/wifi
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

27 lines
573 B
Bash
Executable file

#!/usr/bin/env bash
status=$(nmcli g | tail -n 1 | awk '{print $1}')
signal=$(nmcli -t -f in-use,signal device wifi list | rg "\*" | cut -d: -f2)
essid=$(nmcli -t -f in-use,ssid dev wifi | rg "\*" | cut -d: -f2)
icons=("󰤯" "󰤟" "󰤢" "󰤥" "󰤨")
if [ "$status" = "disconnected" ]; then
icon=""
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
case $1 in
--COL) echo $color ;;
--ESSID) echo $essid ;;
--ICON) echo $icon ;;
esac