Evie Litherland-Smith
be1d5fa798
Save reference for later Enable upower daemon and add simple bar with the essentials for now, TODO more later
27 lines
573 B
Bash
Executable file
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
|