#!/bin/sh
# Show internet connection status with (f05a9) icon
case $BLOCK_BUTTON in
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
3) notify-send " Internet module" "\- Click to connect
- Shows connection quality percentage" ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
# Check wifi
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ]; then
quality=$(awk '/^\s*w/ { print int($3 * 100 / 70) }' /proc/net/wireless)
printf " %s%%\n" "$quality"
# Check ethernet
elif [ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ]; then
printf "\n"
else
printf " --\n"
fi