You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
781 B

2 years ago
#!/bin/sh
case $BLOCK_BUTTON in
1) $TERMINAL -e nmtui ;;
3) pgrep -x dunst >/dev/null && notify-send "󰌙 Internet module" "\- Click to connect
󰞃: no wifi connection
󰢾: wifi connection with quality
󰌙: no ethernet
󰌘: ethernet working
" ;;
esac
if [ "$(cat /sys/class/net/w*/operstate)" = 'down' ]; then
wifiicon="󰞃";
else
signal=$(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)}');
if [ "$signal" -ge 0 ] && [ "$signal" -le 35 ]; then
wifiicon="󰢼 $signal%"
elif [ "$signal" -ge 35 ] && [ "$signal" -le 70 ]; then
wifiicon="󰢽 $signal%"
elif [ "$signal" -ge 70 ] ; then
wifiicon="󰢾 $signal%"
fi
fi
printf "%s %s\n" "$wifiicon" "$(sed "s/down/󰌙 /;s/up/󰌘 /" /sys/class/net/e*/operstate)"