#!/usr/bin/env sh ###################################################################### # @author : swytch (adapted from Luke Smith - lukesmith.xyz) # @file : sb-internet # @license : GPLv3 # @created : Saturday Feb 13, 2021 17:35:49 CET # # @description : internet block for dwmblocks ###################################################################### # Wifi quality percentage and  icon if ethernet is connected. wifi="$(grep "^\s*w" /proc/net/wireless | awk '{ printf int($3 * 100 / 70) }')" [ -n "$wifi" ] && str="$(printf "直 %3d%%" $wifi)" || str="$(printf "睊")" eth="$(cat /sys/class/net/eno1/operstate)" if [ "up" = "$eth" ]; then str="$(printf "%s /  " "$str")" fi vpn="$(pidof openvpn)" [ -n "$vpn" ] && str="$(printf "() %s" "$str")" printf " %s " "$str"