This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/statusbar/sb-internet

21 lines
690 B
Plaintext
Raw Normal View History

#!/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) }')"
2021-02-16 20:53:50 +01:00
[ $wifi -ne 0 ] && printf " 直 %3d%% " $wifi || printf " 睊 --- "
eth="$(cat /sys/class/net/enp0s25/operstate)"
if [ "up" = "$eth" ]; then
2021-02-16 20:53:50 +01:00
printf " /  "
fi