Compare commits

..

No commits in common. "efe45fbe929f8d02eef2fa108a0164992c20c8de" and "8173732805e6c17aadae39c9b838b7e50b08665d" have entirely different histories.

2 changed files with 12 additions and 19 deletions

View File

@ -27,29 +27,22 @@ do
printf '\n' &&
continue
unset status
status=$(sed "s/Not charging/🛑/" "$battery"/status)
status=$(sed "s/Discharging//;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/🔋/;s/Full/⚡/" "$battery"/status)
# Center picture around the actual capacity.
# Displayable capacities: 0, 1/4, 1/2, 3/4, 1 -> intervall of length 25% centered around displaycategory
# -> +- 12.5% for every level
if grep -qE "(Discharging|Charging)" "$battery"/status; then
status=
[ "$capacity" -le 87 ] &&
status=""
[ "$capacity" -le 63 ] &&
status=""
[ "$capacity" -le 37 ] &&
status=""
if [ "$status" = "" ]; then
[ "$capacity" -le 13 ] &&
status=""
[ "$capacity" -le 5 ] &&
status="❗"
if grep -q "Charging" "$battery"/status; then
status="${status}🔌"
fi
[ "$capacity" -le 37 ] &&
status=""
[ "$capacity" -le 63 ] &&
status=""
[ "$capacity" -le 87 ] &&
status=""
fi
printf "%s \n" "$status"
printf "%s\n" "$status"
else
echo "Error. Capacity:$capacity" > /dev/stderr #if battery fails during reading, quit
fi
done
done | sed 's/ *$//'

View File

@ -21,10 +21,10 @@ esac
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
wifiicon="$(awk '/^\s*w/ { print "" }' /proc/net/wireless)"
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon=" " || wifiicon="❌ "
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="📡 " || wifiicon="❌ "
fi
# Ethernet
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=""
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="🌐"
printf "%s%s%s\n" "$wifiicon" "$ethericon"