fix: fix dwmbar section length

This commit is contained in:
swytch 2020-09-02 15:55:25 +02:00
parent e26b809f6c
commit f70a7179d9

View File

@ -30,8 +30,8 @@ status() { \
printf "$delim" printf "$delim"
# Wifi quality percentage and  icon if ethernet is connected. # Wifi quality percentage and  icon if ethernet is connected.
wifi="$(grep "^\s*w" /proc/net/wireless | awk '{ printf "索 %3d", int($3 * 100 / 70) }')" wifi="$(grep "^\s*w" /proc/net/wireless | awk '{ printf int($3 * 100 / 70) }')"
printf "$wifi%%" [ $wifi -ne 0 ] && printf "索 %3d%%" $wifi || printf "索 ---"
eth="$(cat /sys/class/net/enp0s25/operstate)" eth="$(cat /sys/class/net/enp0s25/operstate)"
if [ "up" = "$eth" ]; then if [ "up" = "$eth" ]; then
printf " / " printf " / "
@ -45,7 +45,7 @@ status() { \
AC_ON="$(cat /sys/class/power_supply/AC/online)" AC_ON="$(cat /sys/class/power_supply/AC/online)"
for x in /sys/class/power_supply/BAT?/capacity; for x in /sys/class/power_supply/BAT?/capacity;
do do
if [ "$AC_ON" = 0 ]; then if [ $AC_ON -eq 0 ]; then
case "$(cat "$x")" in case "$(cat "$x")" in
10[1-9]) printf "" ;; 10[1-9]) printf "" ;;
100|9[0-9]) printf " %3d%%" $(cat "$x") ;; 100|9[0-9]) printf " %3d%%" $(cat "$x") ;;
@ -55,7 +55,7 @@ status() { \
*) printf " %3d%%" $(cat "$x") ;; *) printf " %3d%%" $(cat "$x") ;;
esac esac
else else
printf " $(cat "$x")%%" printf " %3d%%" $(cat "$x")
fi fi
done && printf "$delim" done && printf "$delim"